Created
March 13, 2016 09:06
-
-
Save maximishchenko/2936edb1983d7e4300cd to your computer and use it in GitHub Desktop.
Yii2 Checking Users Role
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if (Yii::$app->user->can('root')) { | |
| echo 'Hello, Root!'; | |
| } | |
| elseif (Yii::$app->user->can('admin')) { | |
| echo 'Hello, Admin!'; | |
| } | |
| elseif (Yii::$app->user->can('head')) { | |
| echo 'Hello, Head!'; | |
| } | |
| elseif (Yii::$app->user->can('manager')) { | |
| echo 'Hello, Manager!'; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment