Laravel 8 - Decrypt cookies

Viewed 138

In a Laravel 8x project I'm working on, I'm setting a cookie with:

Cookie::queue('systemOne[moduleX][tl]', 'valueOfCookie', 2628000);

I'm reading the cookie and decrypting it with:

$cookie = Crypt::decrypt(Cookie::get('systemOne')['moduleX']['tl'],false); //assume for this example that it won't give any error if cookie is not set

This works well, except that the value of $cookies has an extra pre-pended string and a | delimiter in it:

e80cd502fec2a621b624ead8eb1cc91a2e94846b|valueOfCookie

I could just do an explode to get only what I want but it seems strange that this is happening and it is not described in the docs. Am I doing something wrong?

0 Answers
Related