Home > Net >  How to invalidate a user sessions and cookies with user_id in laravel?
How to invalidate a user sessions and cookies with user_id in laravel?

Time:05-04

In my project admin need to invalidate user auth, and redirect user to login page after receiving the next request from user.

For this operation, anything that authenticates the user must obsolete! but how ?

Something like the following method :

use App\Http\Controllers\Auth\authController;

...
    authController::invalidateAuth($user_id);
...

CodePudding user response:

logout user you want to, by id:

$userToLogout = User::find(5);
Auth::setUser($userToLogout);
Auth::logout();

  • Related