PHP code example of andrewdanilov / yii2-admin-panel

1. Go to this page and download the library: Download andrewdanilov/yii2-admin-panel 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/ */

    

andrewdanilov / yii2-admin-panel example snippets


$config = [
	// ...
	'components' => [
		// ...
		'user' => [
			'class' => 'yii\web\User',
			'identityClass' => 'andrewdanilov\adminpanel\models\User',
			'accessChecker' => 'andrewdanilov\adminpanel\AccessChecker',
			'enableAutoLogin' => true,
			'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
			'loginUrl' => ['user/login'],
		],
	],
];

$config = [
	// ...
	'controllerMap' => [
		'user' => [
			'class' => 'andrewdanilov\adminpanel\controllers\UserController',
			'viewPath' => '@backend/someotherlocation/views/user', // optional, custom UserController views location
			'loginFormClass' => 'backend\models\LoginForm', // optional, default is 'andrewdanilov\adminpanel\models\LoginForm'
		],
	],
];

use yii\helpers\Url;

$userManagerUrl = Url::to(['/user']);

use andrewdanilov\adminpanel\controllers\BackendController;

class AnyController extends BackendController
{
	// ...
}

use andrewdanilov\adminpanel\controllers\BackendController;

class AnyController extends BackendController
{
	// ...
	public function actions()
	{
		$actions = parent::actions();
		$actions['error']['layout'] = 'error';
		return $actions;
	}
	// ...
}

/* @var $dataProvider \yii\data\ActiveDataProvider */
/* @var $searchModel \yii\db\ActiveRecord */
use yii\grid\GridView;

php yii migrate --migrationPath=@andrewdanilov/adminpanel/migrations