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