Reputation: 4412
On Yii framework 2, I set the User status to 1 after logging in and to 2 after manual logging out as following.
//after logging in
$user->status = 1;
$user->save(true, ['status']);
//after manual logging out
$user->status = 2;
$user->save(true, ['status']);
But Yii framework 2 has a mechanism to automatically clear the login session after user is inactive for awhile. How can I then update the User status in this case?
Upvotes: 0
Views: 474
Reputation:
Do it in afterLogout()
method in class inherited from
Yii\web\User
?
Upvotes: 1