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');
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
- ¥15 android报错 brut.common.BrutException: could not exec (exit code = 1)
- ¥15 nginx反向代理获取ip,java获取真实ip
- ¥15 eda:门禁系统设计
- ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
- ¥15 376.1电表主站通信协议下发指令全被否认问题
- ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
- ¥15 复杂网络,变滞后传递熵,FDA
- ¥20 csv格式数据集预处理及模型选择
- ¥15 部分网页页面无法显示!