当用户已登录,但访问被限制的路径时,会被重定向至指定路径。该路径在以下中间件中定义:
app/Http/Middleware/RedirectIfAuthenticated.php
class RedirectIfAuthenticated { . . . public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { session()->flash('info', '您已登录,无需再次操作。'); return redirect('/'); } . . . } }