/** * @param \yii\base\Action $action * @return bool * @throws \yii\web\BadRequestHttpException */ public function beforeAction($action) { if (parent::beforeAction($action)) { if ($action->id == 'error' && Yii::$app->user->isGuest) { $this->layout = 'main-login'; } return true; } else { return false; } }
public function behaviors() { return ArrayHelper::merge(parent::behaviors(), ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]]); }
public function behaviors() { $behavior = parent::behaviors(); $access = $behavior['access']; return ['access' => $access, 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]]; }
/** * @inheritdoc */ public function behaviors() { return ArrayHelper::merge(parent::behaviors(), ['access' => ['class' => AccessControl::className(), 'rules' => [['actions' => ['error'], 'allow' => true], ['actions' => ['index'], 'allow' => true, 'roles' => ['@']]]]]); }