lee-to/laravel-cart

Laravel cart module

0.5 2021-01-17 14:13 UTC

This package is auto-updated.

Last update: 2024-11-11 15:10:36 UTC


README

Install

  • composer require lee-to/laravel-cart

  • php artisan vendor:publish --provider="Leeto\Cart\Providers\CartServiceProvider"

  • set models and tables in config cart.php

Usage

Get cart items
Cart::get();
Get all user carts
Cart::userCarts(optional USER_ID);
Add to cart
Cart::add(PRODUCT_ID, optional [VARIANT_ID_1, VARIANT_ID_2]);
Change quantity
Cart::quantity(CART_ITEM_ID, NEW_COUNT);
Total cart price
Cart::total();
Total cart count
Cart::count();
Remove
Cart::remove(CART_ITEM_ID);
Clear all
Cart::flush();