lundi 2 novembre 2015

Laravel 5 Cookie:get returns null if EncryptCookies turned on

I'm trying to store some information in cookies in this way:

setcookie("o_favourites", serialize($fav_ids), time()+60*60*24*1825);

If EncryptCookies is turned on (by adding \App\Http\Middleware\EncryptCookies::class, presents in $middleware section of app/Http/Kernel.php) I recieved null when trying to get cookies:

$cookie = Cookie::get('o_favourites');

What could cause this behaviour?


BTW I use setcookies(), because Cookie::queue(Cookie::forever('o_favourites', serialize($fav_ids), null, null, false, false)); seems not working



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire