Answer the question
In order to leave comments, you need to log in
Yii2: how to set a module in defaultRoute?
It is necessary that by default the page with authorization opens.
If you write defaultRoute = 'user/login'
(user - module) - then the error is:
Unable to resolve the request "".
Answer the question
In order to leave comments, you need to log in
$config = [
// ...
'defaultRoute' => '/модуль/контроллер_модуля/нужный_action',
// ...
];
In general, if I'm not mistaken, then this is resolved by the filters of the controllers. In site/index put
public function behaviors() {
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'actions' => ['index', какие-то еще методы],
'roles' => [ '@']
],
[
'allow' => true,
'actions' => ['index'],
'roles' => ['@']
],
[
'allow' => false
]
]
]
];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question