Closed fadedshadowx closed 4 years ago
Hello
You need to call Cart::store($user->id);
to persist you cart
I don't understand. Can you example full code for create cart and add to cart something? Why you are using $user->id, what if not logged?
If user is not logged in then use something that can identify him. For example, his session id.
Ok, so:
Cart::add('1', 'ProductName', '100', 1);
Cart::store('example2');
$cartItems = Cart::content('example2');
dd($cartItems);
i have dumped cart and new record in db, but after use only
$cartItems = Cart::content('example2');
dd($cartItems);
still dd is empty, why? Can you reply me? Documentation does not contain these informations.
edit: ok, after use restore option can use content.
Yes, you need to use Cart::restore()
.
Sorry that docs are not so clear. I have almost never used this package myself. I wrote it per one evening for my job interview and after that I have only been maintaining it.
You always can send pull request with enhancements.
Something wrong, I am using Laravel 7.
Using this code:
I have:
but after reload page, cart is empty. Table 'shopping_cart' is empty too.
My repository: `'repository' => \Melihovv\ShoppingCart\Repositories\ShoppingCartDatabaseRepository::class,
'database' => [
What's wrong?