I want to add costum session and session values query from user table (database)
where I put Yii::$app->session->set('blabla','1234')
?
If I put in login controller and user is set auto login (not access login), the session can't set
I want to add costum session and session values query from user table (database)
where I put Yii::$app->session->set('blabla','1234')
?
If I put in login controller and user is set auto login (not access login), the session can't set
In your app\components\User
component you could just hook to the afterLogin
event
example:
namespace \app\components;
Class User extends \yii\web\User{
public function afterLogin($identity, $cookieBased, $duration){
parent::afterLogin($identity, $cookieBased, $duration);
Yii::$app->session->set('blabla','1234')
}
}
ref http://www.yiiframework.com/doc-2.0/yii-web-user.html#afterLogin()-detail