1In web request context cookies are usually automatically encrypted and
2decrypted by the EncryptCookies middleware. So easiest option would be just to
3enable this middleware (and its enabled by default in Laravel).
4
5If you need to decrypt any value manually, the following will do the trick:
6// get the encrypter service
7$encrypter = app(\Illuminate\Contracts\Encryption\Encrypter::class);
8// decrypt
9$decryptedString = $encrypter->decrypt($encryptedString);
10
11Check the code of the EncryptCookies middleware to learn more about what it
12does internally.
13
14############### Or Other Method ########################
15
16By default Crypt::decrypt tries to deserialize the value, and yours is not
17serialized and thats why you get the error. You need to pass a second argument
18like:
19
20Crypt::decrypt(Cookie::get('userId'), false);