Skip to content

Instantly share code, notes, and snippets.

@monbang
Created May 1, 2020 15:31
Show Gist options
  • Save monbang/80be44f8aff1fb184a0e7c44c9cc0c0d to your computer and use it in GitHub Desktop.
Save monbang/80be44f8aff1fb184a0e7c44c9cc0c0d to your computer and use it in GitHub Desktop.
Yii2 module wise user login
public function init()
{
parent::init();
Yii::$app->set('user', [
'class' => 'yii\web\User',
'identityClass' => 'app\models\Editor',
'enableAutoLogin' => false,
'loginUrl' => ['yonetim/default/login'],
'identityCookie' => ['name' => 'editor', 'httpOnly' => true],
'idParam' => 'editor_id', //this is important !
]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment