Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel$redirectPath不';行不通_Php_Laravel - Fatal编程技术网

Php Laravel$redirectPath不';行不通

Php Laravel$redirectPath不';行不通,php,laravel,Php,Laravel,我正在使用Laravel社交名媛启用社交登录。用户从社交网站返回后,我将以/dashboard/id等形式重定向到仪表板页面 现在,当我直接关闭此仪表板页面,并在浏览器中重新打开登录页面(url:auth/login)。它开始重定向到默认的/home。但是有线的事情是,它没有经过默认的getLogin()方法,因此我在AuthController中设置的$redirectPath根本不起作用 在sociallite中,我使用Auth::login()方法对用户进行身份验证 Laravel版本是5

我正在使用Laravel社交名媛启用社交登录。用户从社交网站返回后,我将以
/dashboard/id
等形式重定向到仪表板页面

现在,当我直接关闭此仪表板页面,并在浏览器中重新打开登录页面
(url:auth/login)
。它开始重定向到默认的
/home
。但是有线的事情是,它没有经过默认的getLogin()方法,因此我在AuthController中设置的
$redirectPath
根本不起作用

在sociallite中,我使用
Auth::login()
方法对用户进行身份验证

Laravel版本是5.1

有人能解释一下这背后的逻辑吗?为什么不调用getLogin方法

社交名流回拨:


授权控制器:



你需要在你的路线中定义这样的“家”

Route::get('/', [   
    'uses' => 'YourController@yourMethod',
    'as' => 'home' //As home 
]);
当您将该路由设置为“home”时,您需要修改RedirectIfAuthenticated.php中的中间件

public function handle($request, Closure $next)
    {
        if ($this->auth->check()) {
            return redirect()->route('home'); //Redirect to 'home' previously defined in your routes
        }

        return $next($request);
    }
Route::get('/', [   
    'uses' => 'YourController@yourMethod',
    'as' => 'home' //As home 
]);
public function handle($request, Closure $next)
    {
        if ($this->auth->check()) {
            return redirect()->route('home'); //Redirect to 'home' previously defined in your routes
        }

        return $next($request);
    }