bumbummen99 / LaravelShoppingcart

A simple shopping cart implementation for Laravel
MIT License
501 stars 228 forks source link

Fix create createCartItem call #181

Closed Kwaadpepper closed 1 year ago

Kwaadpepper commented 1 year ago

Fix the Cart add function using Buyable model

bumbummen99 commented 1 year ago

The changes do not really make sense, the $name argument can be the quantity when the first argument is a Buyable. Please see the examples, it is withing the first chapter: Cart::add()

If you still feel that these changes should be merged please open another pull request.

Kwaadpepper commented 1 year ago

The issue I have is that using this method I cannot pass options. I need to pass options to the add to cart, while passing model that are buyable.

Kwaadpepper commented 1 year ago

My bad just read this example using the facade it will be handled it seems, I made the pr because while debugging the part seemed not very clear. And this PR solved my issue. Again I was not using the facade, because it does not privé dock block definitions mostly.

bumbummen99 commented 1 year ago

It should be handled by the facade as well as a cart instance. The ability to call add with multiple types of arguments is not as clear when coming from the code itself, my refactor PR does improve this a bit by introducing multiple argument type hints but it could be simplified even more by reducing the amount of ways an item can be added.

https://github.com/bumbummen99/LaravelShoppingcart/pull/145