andskur/laracart

This package is abandoned and no longer maintained. No replacement package was suggested.

Simple Shoping Cart for Laravel framework

dev-master 2017-06-14 08:01 UTC

This package is not auto-updated.

Last update: 2024-02-04 00:00:31 UTC


README

LaraCart is simple shoping Cart for Laravel framework

Install

composer require andskur/laracart

Configuration

After installing, register the Andskur\LaraCart\LaraCartServiceProvider in your config/app.php configuration file:

'providers' => [
    // Other service providers...

    Andskur\LaraCart\LaraCartServiceProvider::class,
],

Also, add the LaraCart facade to the aliases array in your app configuration file:

'LaraCart' => Andskur\LaraCart\LaraCartFacade::class,

Usage

Add item to cart

Add a new item.

example:

$discount = [
    "value" => 10,
    "type"  => 'percent',
    "start" => 1496228400,
    "end"   => 1497204305
];
$subitems = [
    [1, 1, 'salami', 23],
    [2, 3, 'pepper', 15]
];
LaraCart::storeItem(1, 4, 'pizza', 50, $discount, $subitems);
...

Add sub item to cart row

Add sub item.

example:

LaraCart::addSubItem(2, 2, 'salami', 23, 1);
...

Check item in cart

Check item.

example:

LaraCart::checkItem($id);
...

Get all cart

All cart.

example:

LaraCart::getAll();
...

Get item from cart

Get item.

example:

LaraCart::getItem($id);
...

Delete item from cart

Remove item.

example:

LaraCart::delItem($id);
...

Get full cart total price

Full price.

example:

LaraCart::cartPrice();
...

Get full cart total price with discount

example:

LaraCart::cartPriceDiscount();
...

License

LaraCart is open-sourced software licensed under the MIT license