[英]I want to load a gif image when user clicks on logout and then redirects to home page. i am trying to do using php
[英]In laravel 6, when I'm using logoutOtherDevices(), other devices got logout but redirected to login page. How can I change it to home page?
我正在使用自定义身份验证和中间件,但是当使用 logoutOtherDevices 功能时,它可以正常工作,但会将它们重定向到 /login。 我想将它们重定向到主页,即 /home
你需要重写app\/Exceptions\/Handler.php的extendble类的未认证方法,这个文件是laravel的默认文件,在会话过期时处理。 要解决这个问题,只需在您的 app\/Exceptions\/Handler.php 中编写此代码
protected function unauthenticated($request, AuthenticationException $exception)
{
return $request->expectsJson()
? response()->json(['message' => $exception->getMessage()], 401)
: redirect()->guest($exception->redirectTo() ?? route('YOUR ROUTE HERE'));
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.