When the session expires my users are getting redirected to /login however they should be redirected to /backoffice/login, does anyone know in which file I can change the redirection part?
作者会话的Laravel Change Redirect部分到期
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
dongroufan6846 2016-11-02 15:16关注Your Exception Handler is what takes all unauthenticated requests and handles them in the way you need.
It will look something like this:
app/Exceptions/Handler.php
/** * Convert an authentication exception into an unauthenticated response. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Auth\AuthenticationException $exception * @return \Illuminate\Http\Response */ protected function unauthenticated($request, AuthenticationException $exception) { if ($request->expectsJson()) { return response()->json(['error' => 'Unauthenticated.'], 401); } return redirect()->guest('login'); }You can adjust the redirect by changing
return redirect()->guest('login');toreturn redirect()->guest('backoffice/login');本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报