https://github.com/lee-to/laravel-cart
https://github.com/lee-to/laravel-cart
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lee-to/laravel-cart
- Owner: lee-to
- License: mit
- Created: 2021-01-17T14:12:34.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-11T07:46:00.000Z (almost 4 years ago)
- Last Synced: 2025-03-26T09:01:46.738Z (2 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# laravel-cart
## 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
```php
Cart::get();
```##### Get all user carts
```php
Cart::userCarts(optional USER_ID);
```##### Add to cart
```php
Cart::add(PRODUCT_ID, optional [VARIANT_ID_1, VARIANT_ID_2]);
```##### Change quantity
```php
Cart::quantity(CART_ITEM_ID, NEW_COUNT);
```
##### Total cart price```php
Cart::total();
```##### Total cart count
```php
Cart::count();
```##### Remove
```php
Cart::remove(CART_ITEM_ID);
```##### Clear all
```php
Cart::flush();
```