本文整理汇总了PHP中app\models\Users::isUserAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::isUserAdmin方法的具体用法?PHP Users::isUserAdmin怎么用?PHP Users::isUserAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Users
的用法示例。
在下文中一共展示了Users::isUserAdmin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: behaviors
public function behaviors()
{
return ['access' => ['class' => AccessControl::className(), 'only' => ['index', 'view', 'create', 'delete', 'update'], 'rules' => [['actions' => ['index', 'view', 'create', 'delete', 'update'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
return Users::isUserAdmin(Yii::$app->user->identity->login);
}]]]];
}
示例2: isset
?>
</head>
<body>
<?php
$this->beginBody();
?>
<div class="wrap">
<?php
NavBar::begin(['brandLabel' => 'Аренда залов', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItem = [['label' => '<span class="glyphicon glyphicon-home" aria-hidden="true"></span> Главная', 'url' => ['/site/index'], 'encode' => false]];
if (Yii::$app->user->isGuest) {
$menuItem[] = ['label' => 'Регистрация', 'url' => ['/users/index']];
$menuItem[] = ['label' => 'Войти', 'url' => ['/site/login']];
} else {
if (Users::isUserAdmin(Yii::$app->user->identity->login)) {
$menuItem[] = ['label' => ' <span class="glyphicon glyphicon-book" aria-hidden="true"></span> Справочники', 'encode' => false, 'items' => [['label' => '<span class="glyphicon glyphicon-book" aria-hidden="true"></span> Залы', 'url' => ['/zal/index'], 'encode' => false], ['label' => '<span class="glyphicon glyphicon-user" aria-hidden="true"></span> Оборудование', 'url' => ['/oborud/index'], 'encode' => false], ['label' => '<span class="glyphicon glyphicon-road" aria-hidden="true"></span> Клиенты', 'url' => ['/client/index'], 'encode' => false], ['label' => '<span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> Пользователи', 'url' => ['/users/index'], 'encode' => false], ['label' => '<span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> Аренда', 'url' => ['/event/index'], 'encode' => false]]];
}
$menuItem[] = ['label' => 'Выйти (' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItem]);
NavBar::end();
?>
<div class="container">
<?php
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
<?php
echo $content;
?>