SiteController
public function beforeAction(){
if(Yii::$app->user->can('admin')){
return true;
} else {
throw new ForbiddenHttpException;
}
}
Ошибка на сайте:
An Error occurred while handling another error:
exception 'yii\web\NotFoundHttpException' with message 'The requested page does not exist.' in A:\my_projects\advanced.local\www\backend\controllers\SiteController.php:62
Stack trace:
#0 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\Controller.php(149): backend\controllers\SiteController->beforeAction(Object(yii\web\ErrorAction))
#1 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\Module.php(455): yii\base\Controller->runAction('error', Array)
#2 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\web\ErrorHandler.php(85): yii\base\Module->runAction('site/error')
#3 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\ErrorHandler.php(109): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException))
#4 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))
#5 {main}
Previous exception:
exception 'yii\web\NotFoundHttpException' with message 'The requested page does not exist.' in A:\my_projects\advanced.local\www\backend\controllers\SiteController.php:62
Stack trace:
#0 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\Controller.php(149): backend\controllers\SiteController->beforeAction(Object(yii\base\InlineAction))
#1 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\Module.php(455): yii\base\Controller->runAction('', Array)
#2 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\web\Application.php(84): yii\base\Module->runAction('site', Array)
#3 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#4 A:\my_projects\advanced.local\www\backend\web\index.php(18): yii\base\Application->run()
#5 {main