Skip to content

Instantly share code, notes, and snippets.

@YasinPatel
Last active July 17, 2017 08:01
Show Gist options
  • Save YasinPatel/e048a889abe56bb7014bbca6a26174bb to your computer and use it in GitHub Desktop.
Save YasinPatel/e048a889abe56bb7014bbca6a26174bb to your computer and use it in GitHub Desktop.
Module wise login in yii2
<?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