I wrote a simple code that it is redirecting back after I click on button. The redirect is with cookie, but when I read it, it is encrypted, how can I read decrypted value of cookie?
How it works? I have a FrontendController, that includes layout and when I am changing the style it calls through the route /s/dark
The controller Homepage calls Frontend function which is extended, and after this I have to read the cookie, but it is encrypted.
function setStyle($style = "light") {
if($this->cookie->getCookie('style') == "light") {
$style = "dark";
} else {
$style = "light";
}
return redirect()->back()->withCookie(cookie('style', $style));
}
EDIT
I am expecting light value in cookie, but I have got something like this eyJpdiI6IitEUWc2WDlBT1l3bDcyNW1YbnlcL3RBPT0iLCJ2YWx1ZSI6IlNRQ2ZhcG5INE1iNVwvalZMTjFOZVBRPT0iLCJtYWMiOiJmOTFkYTU1ZTY0MTU5NDVhMjQzYWFhZTQxNzdkZGRlZDJkNThhMDU0YTE0YjYwMDU4NzZmYTI2ZTk5ZWIyY2Y1In0=
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2ZQDm1g
via IFTTT
Aucun commentaire:
Enregistrer un commentaire