ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## Laravel中涉及认证跳转地址的修改的地方 登录后跳转: 在`app\Http\Auth\LoginController.php`中修改 ``` protected $redirectTo = '/home'; ``` 已登录,访问登录接口时跳转: 修改`app\Http\Middleware\RedirectIfAuthenticated.php`中的`handle()`方法: ``` public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { return redirect('/home'); } return $next($request); } ``` 未登录访问需要登录页面时的跳转 修改`app\Http\Exceptions\Handler.php`中的`unauthenticated()`方法: ``` protected function unauthenticated($request, AuthenticationException $exception) { if ($request->expectsJson()) { return response()->json(['error' => 'Unauthenticated.'], 401); } return redirect()->guest(route('login')); } ```