TIPOFF / checkout

Laravel Package for Ecommerce Checkouts
MIT License
0 stars 1 forks source link

Sellable Trait #28

Closed drewroberts closed 3 years ago

drewroberts commented 3 years ago

Create a trait to allow the checkout (Cart with Cart Items) to be added to packages as Sellable items:

There will also be other packages in the future with other variations of sellable items that can be added to a cart and process through the checkout in an order.

pdbreen commented 3 years ago

Instead of a trait, this was implemented using a base Sellable interface that is extended for different types of sellable items. Models that are sellable declare they implement the appropriate interface and add any methods the interface requires. Cart items and order items contain a morph to the sellable model.

https://github.com/tipoff/support/tree/main/src/Contracts/Sellable