Answer the question
In order to leave comments, you need to log in
Display user role, Yii2?
Good afternoon! Can you please tell me how to display user role in Yii2?
For example, I have an admin and a manager and I need to display this according to who entered.
I did not work with Yii2, but now I need to quickly figure it out.
Thank you in advance!)
Answer the question
In order to leave comments, you need to log in
https://stackoverflow.com/questions/26763298/how-d...
Translating. Everything is available written.
how to display user role in Yii2?
For example, like this:
The $var variable will contain an array with instances of the yii\rbac\Role class.
Next, we check the presence of the desired role in the array.
Another shorter option:
Where $role is the name of your role/permission.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question