Crinsane / LaravelShoppingcart

A simple shopping cart implementation for Laravel
MIT License
3.66k stars 1.72k forks source link

Cart::content don't work #411

Open devalexandre opened 6 years ago

devalexandre commented 6 years ago

when I use a add, it's wok but I try get items using Cart::content in other class, don't work

Crinsane commented 6 years ago

Please give some code, otherwise I have no way to help you. Make sure you don't use dd() anywhere, because that will destroy the session (this usually seems to be the problem for many people) And make sure you really have a session (API routes by default don't have a session)

devalexandre commented 6 years ago

https://gist.github.com/devalexandre/ac1f6410a434000f73f1fc760a55970f

when I use add work, but when I try get in other route using a getList, is are empty

olimortimer commented 6 years ago

This is worth a read - https://andremadarang.com/implementing-a-shopping-cart-in-laravel/

The repo for the example is here - https://github.com/drehimself/laravel-shopping-cart-example

ali-ongarbekovich commented 6 years ago

Maybe you should use Cart::instance('default')->content() instead of Cart::content() ?