ankurk91/laravel-shopping-cart
最新稳定版本:1.6.0
Composer 安装命令:
composer require ankurk91/laravel-shopping-cart
包简介
Shopping cart manager for Laravel
README 文档
README
Shopping cart manager for Laravel.
Installation
You can install the package via composer:
composer require "ankurk91/laravel-shopping-cart"
Usage
You can use Facade
<?php use Ankurk91\LaravelShoppingCart\Facades\ShoppingCart; use App\Models\Product; $product = Product::find(1); $quantity = request('quantity'); $attributes = [ 'image_url' => asset('image.webp'), ]; $item = ShoppingCart::add( $product, $product->name, $product->unit_price, $quantity, $attributes, ); ShoppingCart::find(1); ShoppingCart::update($product->id, 3); ShoppingCart::all(); ShoppingCart::count(); ShoppingCart::has($product); ShoppingCart::isEmpty(); ShoppingCart::subtotal(); ShoppingCart::remove($product->getKey()); ShoppingCart::clear();
Or you can locate it from container
<?php use Ankurk91\LaravelShoppingCart; $shoppingCart = app(ShoppingCartManager::class); $shoppingCart->all();
Note The cart items will be stored in default session storage.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
composer test
Security
If you discover any security issues, please email pro.ankurk1[at]gmail[dot]com instead of using the issue tracker.
Attribution
This package is highly inspired by overtrue/laravel-shopping-cart
License
The MIT License.
统计信息
- 总下载量: 932
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-23