laracart
laracart copied to clipboard
Return this cart item (when adding associate model).
Hi I started trying to use your package in my application. Thanks.
I would like that when linking the model:
LaraCart::add($product-> id, $product->name,1, $product->price, $cart['options'])->setModel(Product::class);
the currently added item to the cart was returned to us, but this does not happen since setModel () returns null.
Why you need to do a similar design
$cart = LaraCart::add($product-> id, $product->name,1, $product->price, $cart['options'])->setModel(Product::class);
$cart->setModel(Product::class);
Thanks
just needs to return this
when I set that model.
There is also a problem with adding two identical products, which should be combined in quantity with each other, but this does not happen, but an error occurs:
"Call to a member function setModel () on null".
The error always appears when adding the same product to the cart a second time.
Thanks