laravelshoppingcart
laravelshoppingcart copied to clipboard
Do I need to use the Cart :: session ($ userId) -> method view each time?
Do I need to use the Cart :: session ($ userId) -> method view each time?
public function __construct()
{
$userId = auth()->user()->id;
Cart::session($userId);
}
or does he use it in subsequent methods by writing once? like
public function delete($id)
{
// removing cart item cart
Cart::remove(456);
return back()->with('success_message', __('Item deleted!'));
}
How do I save cart item rowID? where rowID is stored and how I can access it?
@Shaykhnazar please refer to docs. they are quite self explanatory and simple. Or better have a look at demo with git.
If you are binding $userId to your cart then everywhere it does requires.
so while removing use this method..
Cart::session($userId)->remove(456);