当会话到期时,我的用户正在重定向到/login
,但是他们应该重定向到/backoffice/login
,有人知道我可以在哪个文件中更改重定向部分吗?
你的异常处理程序接收所有未经身份验证的请求,并以你需要的方式处理它们。
它看起来像这样:
/app/异常Handler.php
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param IlluminateHttpRequest $request
* @param IlluminateAuthAuthenticationException $exception
* @return IlluminateHttpResponse
*/
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest('login');
}
您可以通过将return redirect()->guest('login');
更改为return redirect()->guest('backoffice/login');
来调整重定向