Created
February 24, 2016 12:17
-
-
Save zhukovsergei/120e1556aa1cf30cbd2d to your computer and use it in GitHub Desktop.
beforeAction Yii2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function beforeAction($action) | |
{ | |
if (!parent::beforeAction($action)) { | |
return false; | |
} | |
if(\Yii::$app->user->getIsGuest()){ | |
$this->redirect('/'); | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment