Get cookie in the Laravel 5 constructor

get the encrypted value of Cookie in the construction method. How to convert it to unencrypted value

public function __construct()
{
    echo Cookie::get("customer_id");
    // 
    // eyJpdiI6Im5NZVNkTnpJSlFib3BpXC91VmdHWFJ....
}

public function index()
{
    echo Cookie::get("customer_id");
    // 
    // 6
}
Dec.10,2021

  

similar problems were encountered in a 5.4 project. At that time, I just used Laravel, to find that I could not get the content by using the session-related method in the construction method, but I could do it in the method. Later, after consulting the relevant website, I learned about it. Because the controller constructor runtime middleware is not ready, the content cannot be fetched. The solution is to manually load middleware

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37c9c-2c0b5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37c9c-2c0b5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?