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));
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire