我已经更改了受保护的$redirectTo =‘/任务’;在LoginController和RegisterController中。此外,我还将中间件RedirectIfAuthenticated中的重定向路径更改如下:
public function handle($request, Closure $next, $guard = null)
{
    if (Auth::guard($guard)->check()) {
        return redirect('/tasks');
    }
    return $next($request);
}尽管我已经做了这些更改,但是没有什么工作,页面被重定向到/login路径。
发布于 2016-12-30 04:35:56
在看到您的代码之后,我了解到您的IF语句没有返回true。你得先看看,它是怎么回事。此外,重定向到您想要的位置,没有任何条件,只是为了测试代码。
另外,在我的应用程序登录后,我将使用此代码进行重定向。
public function handle($request, Closure $next)
{
    if ($this->auth->check()) {
        return redirect('/home');
    }
    return $next($request);
}https://stackoverflow.com/questions/41389140
复制相似问题