D. Oussama D. Oussama - 4 months ago 12
PHP Question

Disconnect a specific user

I am currently using laravel 5.4, i get the list of online users, and i want from my admin-dashboard to make a specific user from my list to disconnect,
is there a way to do so ?

btl btl
Answer Source

Set a flag in the database, for example, to mark the user as needing to logout. Then on their next request, in say a middleware, you can do:

if (Auth::user()->should_logout) {
    Auth::logout();
}