Open tariqtraders opened 5 years ago
Sessions are not implemented in api.php
route file. Since Cart needs session to store the items, you should use web.php
route file.
@tariqtraders If u add \Illuminate\Session\Middleware\StartSession::class
to ur api middleware group in App\Http\Kernel.php
it should be fine? See this solution.
@augustusnaz then it will store all order for same user in same cart
You could also store in the front-end a unique session since REST is supposed to be stateless. In this way, you can have non-users and users using your API
Hi I am using following code to get all contents in web application and it works fine
\Cart::session($sessionKey)->getContent()
but when i use in rest api. it gives the last item added to cart and not all. Can anyone tell me how to implement this cart using api