I figured it out
There's only three places Laravel uses the Crypt package.
- Caches. Specifically if you're using the Database Cache driver then values placed in the cache are encrypted prior to saving and decrypted when loaded.
- Cookies. Cookie values are always sent to the user encrypted. When the request loads, all cookie values are decrypted.
- Queues. Specifically if you're using the iron queue driver then values are stored in the queue encrypted and decrypted once retrieved.
Because of point no 2 ... we will be logged out of the system
so better to reset key to original
Crypt::setKey('1');
$pin_code = Crypt::encrypt($pin_codes[$key]);
Crypt::setKey(Config::get('app.key'));//reset to original after job is done