PHP code example of chapcz / admin

1. Go to this page and download the library: Download chapcz/admin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chapcz / admin example snippets



namespace App\BackendModule\Presenters;

use Nette\Application\UI\Presenter;
use Kollarovic\Admin\IAdminControlFactory;


abstract class BasePresenter extends Presenter
{

    /** @var IAdminControlFactory @inject */
    public $adminControlFactory;

    protected function createComponentAdminControl()
    {
        $adminControl = $this->adminControlFactory->create();
        return $adminControl;
    }

}



namespace App\BackendModule\Presenters;

use Kollarovic\Admin\ILoginControlFactory;
use Nette\Application\UI\Presenter;


class SignPresenter extends Presenter
{

    /** @var  ILoginControlFactory @inject */
    public $loginControlFactory;


    protected function createComponentLoginControl()
    {
        $loginControl = $this->loginControlFactory->create();
        $loginControl->onLoggedIn[] = function() {
            $this->redirect('Homepage:default');
        };
        return $loginControl;
    }

}