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 ta
The answer that Alexey Mezenin gave is correct. People are not looking at the other user perspective. Auth will return the current user information.
So for example, User1 wants to log user2 out, User1 clicks on a href link that will log the user2 out. When this link is clicked, $usersId will contain the id of user2. Now the function will be called when the link is being redirect to the route. Auth refers to the current session. But when user2 is login and his id belongs to the $usersID, his account will be logout.
if(Auth::check() && if (in_array(Auth()->id(), $usersId)) {
Auth::logout()
}