我使用Laravel 5.0内置的验证控制器,并在AuthController我有2个变量的变化重定向:Laravel 5.0 - 当登录失败
protected $redirectTo = '/';
protected $redirectAfterLogout = '/';
是否有这将重定向到一个特定的页面的任何变量当且仅当登录失败?如果不是,我该怎么做?
我使用Laravel 5.0内置的验证控制器,并在AuthController我有2个变量的变化重定向:Laravel 5.0 - 当登录失败
protected $redirectTo = '/';
protected $redirectAfterLogout = '/';
是否有这将重定向到一个特定的页面的任何变量当且仅当登录失败?如果不是,我该怎么做?
请推杆波纹管的方法在你的控制器
public function authenticate(Request $request)
{
if (Auth::attempt(['email' => $request->input('email'), 'password' => $request->input('password')]))
{
return redirect()->intended('dashboard');
} else {
return redirect('your-path-to-redirect');
}
}
我知道这个问题是旧的,但我会公布我的答案,因为它可能是有人在将来有用。
当身份验证失败时,默认情况下它们将被重定向到/auth/login URI。如果要修改这个刚上AuthController添加LOGINPATH属性并设置自己的路径:
protected $loginPath = '/your-path';
可以在Authentication Laravel Docs
希望这有助于找到更多的信息!