darkair / yii2-admin
Yii2 admin panel extension based on madmin extension
Installs: 19
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- dektrium/yii2-rbac: 1.0.0-alpha@dev
- dektrium/yii2-user: ^0.9.12
- e96/yii2-madmin: dev-master
- yiisoft/yii2: ^2.0.6
- yiisoft/yii2-bootstrap: ~2.0.0
- yiisoft/yii2-twig: ^2.0
This package is not auto-updated.
Last update: 2024-11-09 21:17:05 UTC
README
Yii2 admin panel based on MAdmin backend admin engine and RBAC.
##Install
php composer.phar require dektrium/yii2-rbac:1.0.0-alpha@dev
php composer.phar require darkair/yii2-admin:dev-master
Setup
In config file:
[ 'bootstrap' => ['admin'], 'modules' => [ 'admin' => [ 'class' => 'darkair\admin\Module', 'layout' => '@app/views/layouts/admin.twig', // NOTE: You must make your admin template in advance 'as access' => [ 'class' => yii\filters\AccessControl::className(), 'rules' => [ [ 'allow' => true, 'roles' => ['adminAccess'], // Specify the admin permissions ] ] ] ], 'YOUR_ADMIN_MODULE' => [ 'class' => 'YOUR_ADMIN_MODULE_CLASS', 'layout' => '@app/views/layouts/admin.twig', ] ] ]
Migrate:
php yii migrate/up --migrationPath=@yii/rbac/migrations
Usage
-
Create CRUD models via gii. You must to have
<YourModel>.php
and<YourModel>Search.php
classes at least. -
Make your admin controller:
class YourAdminController extends \darkair\admin\AdminController { /** * @return string Name of managed model */ public function getManagedModelClass() { return <YourModel>::className(); } }
- Create rules like this or on another:
Yii::$app->urlManager->addRules([ '/admin/YOUR_ROUTE/<action:\w+>/' => 'YOUR_ADMIN_MODULE/YOUR_CONTROLLER/<action>', ], false);