Using Cookies in Laravel 4
How do you use cookies in Laravel 4?
I'm sure it's simple and something just isn't clicking with me but I need
a little help.
As far as I can tell, you have to create a cookie like this:
$cookie = Cookie::make('test-cookie', 'test data', 30);
Then, aside from returning a custom response, how do you set it? What good
is setting it with a custom response? When would I ever want to do this?
What if I want to set a cookie and return a view? What good does return
Response::make('some text')->withCookie('test-cookie') actually do me
aside from showing me how to use withCookie()?
Like I say, I'm probably just missing something here, but how would I use
a cookie in a practical way...
...like somebody enters info, logs in, etc and I'd like to set a cookie
and take them to a page made with a view?
No comments:
Post a Comment