Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4 - Queueing a cookie forever

In Laravel 4, is there a way to set a queue a cookie that last forever?

Basically I want to mix the functionality of:

Cookie:queue()

and

Cookie:forever()
like image 835
Enrique Moreno Tent Avatar asked Jul 11 '14 06:07

Enrique Moreno Tent


2 Answers

Cookie::queue($name, $value, 2628000)

If you look at the Cookie::forever() code, it defines "forever" as 2628000 (five years)

like image 128
Laurence Avatar answered Oct 19 '22 14:10

Laurence


 Cookie::queue(Cookie::forever($name, $value));
 return $response;

or

$response = Response('hello');
$response->withCookie(Cookie::forever($name, $value));
return $response;
like image 21
Elf Sundae Avatar answered Oct 19 '22 12:10

Elf Sundae