-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All item from different carts shown as user's cart #10
Comments
What does your controller code on /shop URI do? What does it do on other pages? |
@fulopattila122 it does nothing special
If I dd(\Cart::getItems()) inside index method, it shows correct cart items, but if I do the same in the template, it shows me everythins that exists in cart_items table |
Can you show the code you're using in the template? |
{{ dd(Cart::model()) }} at the very beginning |
Never use the Here's a good example how to use the Cart facade in views: https://github.com/vanilophp/demo/blob/0.5/resources/views/cart/show.blade.php |
Did that solve the problem? |
And again, if I output cart items on main page, I see correct cart with only mine items |
Does that route have the web middleware? Looks like you have no session. |
I found out that in the web middleware group \Illuminate\Session\Middleware\AuthenticateSession::class was commented. After uncommenting everything works correct. Thank you so much, you saved my life! |
If I open /shop uri or product page, Cart::getItems() return all items from database that belongs to different carts and users. On other pages everything works fine.
dd(Cart::model()) on /shop uri show this
#relations: array:2 [▼
"user" => User {#722 ▶}
"items" => Collection {#713 ▼
#items: array:4 [▶]
}
]
on any other page:
#relations: []
And ideas why?
The text was updated successfully, but these errors were encountered: