lets say three user is currently logged from three device. one of the user(Admin) want to forcely logout user2 , how can it be achieved in laravel 5.2 ??
Database table structure :: users -> id|name|email|password|remember_token
Update scenario::
user1 --> logged from device 1 [user1 is admin type and has all kind of permission]
user2 --> logged from device 2 [normal user]
user3 --> logged from device 3 [normal user]
currently all user is logged simultaniously. user1 make some changes for user2 and want to re-login user2, there is no way to tell user2 please re-login except make him logout by user1. how can user1 make a user2(remote user) logout ??
Given solution analysis:
$userIdToLogout = 2; // it is user2
if (!is_null(Auth::user()) {
if (Auth::user()->id == $userIdToLogout) {
Auth::logout();
}
}
- Auth::user() will return user1 information NOT user2
- So if (Auth::user()->id == $userIdToLogout) condition will never be true
is my analysis wrong ??