vendredi 9 octobre 2015

Laravel 5.1 - redirect->intended() returns "The HTTP status code "1" is not valid."

I'm attempting to implement the redirect()->intended() method in my login function to bring the now-logged in user back where he came from, but I always get this error:

InvalidArgumentException in Response.php line 470: The HTTP status code "1" is not valid.`

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');
}

When I change the intended(...) to route(...), it works fine but it always redirects to the index route.

Am I missing anything?

Thanks for your help!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire