Download the PHP package cyvelnet/laravel-easycart without Composer
On this page you can find all versions of the php package cyvelnet/laravel-easycart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cyvelnet/laravel-easycart
More information about cyvelnet/laravel-easycart
Files in cyvelnet/laravel-easycart
Package laravel-easycart
Short Description A simple & easy to use yet powerful laravel cart solution
License MIT
Informations about the package laravel-easycart
Laravel EasyCart
This project is still under development, it is far from ready for production.
Installation
Require this package with composer using the following command: ` After updating composer, add the ServiceProvider to the providers array in config/app.php ``
and register Facade
And optionally add a new line to the aliases
array:
'EasyCart' => Cyvelnet\EasyCart\Facades\EasyCart::class,
- Usage
- Filtering
- Condition
- Instances
Usage
EasyCart::add()
Add new product or update quantity on existing cart item
EasyCart::update()
Update cart item
An unique rowId is assigned to each cart item, use
getRowId()on cart item to retrieves rowId
*
EasyCart::remove()
Remove an item from cart
EasyCart::get()
Get a row by rowId
EasyCart::destroy()
Wipe cart completely
EasyCart::qty()
Get the total number of quantity in cart.
EasyCart::subtotal()
Get the cart subtotal before a condition value is being added, use EasyCart::total()
to retrieves the final price
EasyCart::total()
Get the cart total with condition values calculated
EasyCart::items()
Get the cart items EasyCart::content() is an aliase to EasyCart::items()
, Cyvelnet\EasyCart\Collections\CartItemCollection
instance is return
EasyCart::weight()
Get the cart total weight
Filtering
EasyCart::find()
Find a cart item by product id, a Cyvelnet\EasyCart\CartItem
instance is return
EasyCart::findByIds()
Find a cart item by an array of ids, a Cyvelnet\EasyCart\Collections\CartItemCollection
instance is return
Condition
EasyCart support condition, which is essential to ECommerces application, either provides discount or add additional prices are supported.
EasyCart::condition()
Adding a condition is simple, just instantiate a Cyvelnet\EasyCart\CartCondition object and you are ready to go.
Sometimes you want to only give an discount to only to a selected range of products instead of apply to the whole cart, it is easy
Life is not always easy, what if you need to give an discount of 20% but with a maximum up to $50 ?
EasyCart::removeConditionByType()
Remove condition by type
EasyCart::removeConditionByName()
Remove condition by name
Instances
EasyCart support multiple instances, no extra configuration is needed, just point it to instance and it works the same as normal
Instances Expiration
Sometimes a cart expiration is needed, maybe for reservation, or other usage, this is handful in EasyCart
To verify whether a cart is expired, use EasyCart::isExpired()
Since you may expire a cart, you might want to make a countdown too