'How to invalidate a user sessions and cookies with user_id in laravel?
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);
...
Solution 1:[1]
logout user you want to, by id:
$userToLogout = User::find(5);
Auth::setUser($userToLogout);
Auth::logout();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dhruvik Ghevariya |
