php - send redirect and setting cookie, using laravel 5 -
i have written code, sets cookie in client's browser, , after must redirect client 'home' route,
$response = new response(); $response->withcookie(cookie()->forever('language', $language)); $response->header('location' , url('/home')) ; return $response ; the client receives these headers client doesn't make request "home" route 
how should both, setting cookie , redirect user?
why don't return redirect::to('home');
of course can use chaining more things, both in l4 , l5.
l4: return redirect::to('home')->withcookie($cookie);
l5: return redirect('home')->withcookie($cookie);
Comments
Post a Comment