I'm working on a e-commerce project, i'm building the api in Laravel for Mobile Apps and for the web app, i'm using vue-cli for web app
since the api is stateless which uses passport to authenticate user, i couldn't figure out the best way to create the cart functionality with the session and all
1 -> should i create a cart table in database and CRUD the cart details from front end Vue app and the mobile app
2 -> is there a way to create stateless shopping cart
I would store it in the session. You should be able to create a session for not logged in users and then store it in the cart table to identify the guest user.
you add an item to the cart (if it does not exists you create a cart)
vue -> you send it to the api (the item and cookies card_id if exists)
[api] if the cart_id is provided you look it up and add the item, if not you create new cart and add the item, both returning the cart_id and possible the list of all item ids in the cart.