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 enter image description here

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

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -