This question has already been answered:
- Guest redirection to Yii2 login page 2 replies
Hello! I make a personal account on yii2, and immediately there was a problem of authorization.
You need to redirect the guest user to the authorization page, in several controllers, because these controllers should NOT be available to the guest.
You can of course in each controller and in each action to perform a check, but this is not true.
I am sure that in yii it is possible to perform a check in a single method that is loaded before the actions. But the question is which one?
ps yii has just begun to study, so for many, the question may seem nubskim.