Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

itsgoku's avatar

Session issues with LaravelShoppingCart and CSRF Token

I am using https://github.com/Crinsane/LaravelShoppingcart in my laravel application, currently testing locally and use the default file session driver.

Sometimes, my cart becomes empty randomly.

Also have been facing issues with Csrf token. Almost half of my ajax requests gives TokenMismatchException. Its really weird. It wouldn't work and then on clicking it again might work with the same token again.

Am I missing any configurations to make laravel sessions last longer or for the csrf token? What if I do not use VerifyCsrfToken middleware?

0 likes
0 replies

Please or to participate in this conversation.