Last active
July 17, 2017 08:01
-
-
Save YasinPatel/e048a889abe56bb7014bbca6a26174bb to your computer and use it in GitHub Desktop.
Module wise login in 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 | |
namespace app\modules\admin; | |
class Module extends \yii\base\Module | |
{ | |
public $controllerNamespace = 'app\modules\admin\controllers'; | |
public function init() | |
{ | |
parent::init(); | |
\Yii::$app->set('user', [ | |
'class' => 'yii\web\User', | |
'identityClass' => 'app\models\UserAdmin', | |
'enableAutoLogin' => true, | |
'loginUrl' => ['admin/default/login'], | |
'identityCookie' => [ | |
'name' => '_AdminUserstart', // unique for frontend | |
] | |
]); | |
\Yii::$app->set('session', [ | |
'class' => 'yii\web\Session', | |
'name' => '_adminSessionId', | |
'savePath' => sys_get_temp_dir(), | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment