Force logout specific user in laravel 10

53 Views Asked by At

Hi I know there is answer to this questions on forum but they are outdated and they aren't working on laravel 10. I'm using laravel 10 and laravel breeze and I must force logout of this user

$user = User::find($userid);

I was thinking about using code like this

/**
 * Destroy an authenticated session.
 */
public function destroy(Request $request): RedirectResponse
{
    Auth::guard('web')->logout();

    $request->session()->invalidate();

    $request->session()->regenerateToken();

    return redirect('/');
}

from AuthenticatedSessionController

But i don't know how to edit this code to work in my code

0

There are 0 best solutions below