yourickds / adminlte
为 Yii2 的 AdminLTE 模块
1.5.1
2018-11-22 07:40 UTC
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-09-07 12:42:46 UTC
README
Yii2 模块 AdminLTE。
安装
安装此扩展的首选方式是通过 composer。
- 运行以下命令之一
php composer.phar require --prefer-dist "yourickds/adminlte" "*"
或者
"yourickds/adminlte" : "*"
将以下内容添加到应用程序的 composer.json
文件的 require
部分。
- 在应用程序的配置文件的
modules
部分添加一个新的模块,例如
'modules' => [ 'adminlte' => [ 'class' => 'yourickds\adminlte\Init', 'layout' => 'main', // main or top 'layoutBody' => 'fixed', // fixed, layout-boxed or empty 'toggleSidebar' => false, 'sidebarExpandHover' => false, 'toggleRightSidebarSlide' => true, // Toggle between dark and light skins for the right sidebar 'toggleRightSidebarSkin' => 'dark', // skin-blue, skin-black, skin-purple, skin-green, skin-red, skin-yellow, // skin-blue-light, skin-black-light, skin-purple-light, skin-green-light, // skin-red-light, skin-yellow-light 'skin' => 'skin-green', 'dashboard' => 'v2' // v1 or v2 ] ],
- 在应用程序的配置文件的
components
部分添加一个 authManager,例如
'authManager' => [ 'class' => 'yii\rbac\DbManager', 'cache' => 'cache' ],
- 为应用程序的配置文件的
urlManager
添加一个新规则,例如
'urlManager' => [ 'rules' => [ 'admin/<controller>/<action>' => 'adminlte/<controller>/<action>', 'admin' => 'adminlte/dashboard', ], ],
- 为应用程序的配置文件添加一个 Gii CRUD 生成器的模板,例如
$config['modules']['gii'] = [ 'class' => 'yii\gii\Module', 'generators' => [ 'crud' => [ 'class' => 'yii\gii\generators\crud\Generator', 'templates' => [ 'adminlte' => '@vendor/yourickds/adminlte/gii/crud', ] ] ], // uncomment the following to add your IP if you are not connecting from localhost. // 'allowedIPs' => ['127.0.0.1', '::1'], ];
- 使用迁移更新数据库模式
php yii migrate/up --migrationPath=@yii/rbac/migrations
和
php yii migrate/up --migrationPath=@vendor/yourickds/adminlte/migrations