I am using Melihovv ShoppingCart. I want to display all products inside cart but I couldn’t. It shows the page but the products are not displaying.
Here is my code
JavaScript
x
public function store(Request $request)
{
$cartItem = Cart::add($request->id, $request->name, $request->price, 1);
return view('pages.cart')->with([
'cartItem' => $request->cartItem
]);
}
And here is my view:
JavaScript
@if (!empty($cartItem) && count($cartItem) > 0)
@foreach ($cartItem as $product)
{{ $product }}
@endforeach
@endif
Advertisement
Answer
to display the content of the cart, I think you should use
JavaScript
Cart::content()