public function beforeAction($action) { if ($action->id == 'error') { $this->layout = 'error.php'; } return parent::beforeAction($action); }
/** * Show homepage choices * @return mixed */ public function beforeAction($action) { if (\Yii::$app->user->isGuest) { return \Yii::$app->response->redirect(Url::to(['/authentication/login'])); } if (!\Yii::$app->user->identity->isStudent()) { return false; } return parent::beforeAction($action); }
/** * Show homepage choices * @return mixed */ public function beforeAction($action) { if (\Yii::$app->user->isGuest) { return \Yii::$app->response->redirect(Url::to(['/authentication/login'])); } if (!\Yii::$app->user->identity->isEmployee()) { throw new \yii\web\UnauthorizedHttpException("Je bent geen Docent"); } return parent::beforeAction($action); }