Laravel 5.1 - redirect-> intention()返回“HTTP状态代码”1“无效。”

时间:2015-10-09 15:35:22

标签: php authentication laravel-5.1

我正在尝试在我的登录功能中实现redirect()->intended()方法,以便将现在登录的用户带回他来自的地方,但我总是收到此错误:

  

Response.php第470行中的InvalidArgumentException:HTTP状态   代码“1”无效。

public function processLogin($region, $lang)
{
  if (Auth::attempt(['email' => $_POST['email'], 'password' => $_POST['password'], 'active' => 1])) {
        return redirect()->intended('index', array('region' => 'ca', 'lang' => 'fr')); // line that messes up
    }
  return redirect()->route('login', array('region' => 'ca', 'lang' => 'fr'))->withErrors('invalid login');
}

当我将intended(...)更改为route(...)时,它可以正常工作,但它始终会重定向到索引路径。

我错过了什么吗?

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

试试这个。重定向HTTP code 1不允许您随身携带其他参数。重定向意味着您发送请求以显示该特定页面视图和重定向之间存在差异。

我希望这有助于......:)

if (Auth::attempt(['email' => $_POST['email'], 'password' => $_POST['password'], 'active' => 1])) {
    return redirect('index');
}