it-yakutia/yii2-materialadmin
Composer 安装命令:
composer require it-yakutia/yii2-materialadmin
包简介
Material Admin module for Yii2
README 文档
README
Material Admin module for Yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist it-yakutia/yii2-materialadmin "*"
or add
"it-yakutia/yii2-materialadmin": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply add in your backend config:
... 'layoutPath' => '@vendor/it-yakutia/yii2-materialadmin/src/views/layouts', 'components' => [ ... ],
Once the extension is installed, use this SiteController for backend:
/** * Site controller */ class SiteController extends Controller { /** * {@inheritdoc} */ public function behaviors() { return [ 'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'actions' => ['login', 'error'], 'allow' => true, ], [ 'actions' => ['logout', 'index'], 'allow' => true, 'roles' => ['@'], ], ], ], 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'logout' => ['post'], ], ], ]; } /** * @inheritdoc */ public function actions() { return [ 'error' => [ 'class' => 'yii\web\ErrorAction', 'layout' => 'empty' ], ]; } /** * Displays homepage. * * @return string */ public function actionIndex() { return $this->render('index'); } public function actionLogin() { return $this->redirect(['/materialadmin/profile/login']); } }
Once the extension is installed, simply add in your console config:
'controllerMap' => [ ... 'faker' => [ 'class' => \ityakutia\materialadmin\commands\FakerController::class, ], 'migrate' => [ 'class' => MigrateController::class, 'migrationPath' => [ ... '@ityakutia/materialadmin/migrations', ], ], ]
create your custom navitems for @backend/views/layout/_sidenav:
<?php use yii\helpers\Url; ?> <?php if(Yii::$app->user->can("costom_modules")) { ?> <li><a class="subheader grey-text"><i class="material-icons grey-text tiny">public</i> <?= Yii::t('app', 'Мои модули')?></a></li> <?php } ?> <?php if(Yii::$app->user->can("costom_module")) { ?> <li class="<?= (Yii::$app->controller->module->id=='costom_module' && Yii::$app->controller->id=='back')?'active':''; ?>"><a class="waves-effect waves-teal" href="<?= Url::toRoute('/costom_module/back/index') ?>"><i class="material-icons">pageview</i> <?= Yii::t('app', 'Мой модуль') ?></a></li> <?php } ?>
Setting custom logos, simply add in your backend params:
'materialadmin_module' => [
'custom_assets' => [
'logo_favicon' => '/admin/images/logo_favicon.png',
'logo_sidenav' => '/admin/images/logo_sidenav.png',
'logo_login' => '/admin/images/logo_login.png',
],
],
统计信息
- 总下载量: 345
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-04-27