Answer the question
In order to leave comments, you need to log in
How to set behavior for the whole application or module in yii2?
I have a global dynamic behavior that checks for a role and issues permissions.
now I have to write the following construction in each admin controller for verification:
use developeruz\db_rbac\behaviors\AccessBehavior;
'as AccessBehavior' => [
'class' => AccessBehavior::className(),
]
Answer the question
In order to leave comments, you need to log in
no, this cannot be done. You can:
1. Either connect the behavior in the config
2. Or define the behavior in the parent class (separately for each controller, module, etc.)
3. Or attach dynamically to the called controller in each module
https://github.com/ yiisoft/yii2/blob/master/docs/g...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question