Reputation: 4756
I'm trying to create and read a simple cookie in laravel but I don't understand how I can do this.
I've looked at the documentation of laravel, which normally is really solid but the cookie part confuses me.
I don't see the code for create a cookie and it seems like the plain setcookie() isn't working.
Thanks for the help
Upvotes: 0
Views: 1555
Reputation: 683
Like everything else in laravel there are several ways of setting/getting cookies.
I do this (on my controller method) so the cookie will automatically be added to the outgoing response.
Cookie::queue($name, $value, $minutes);
In order to get the cookie you can use the
request()->cookie($name);
Upvotes: 1