定制 ismail1k/laravel-cart 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ismail1k/laravel-cart

最新稳定版本:1.0.0

Composer 安装命令:

composer require ismail1k/laravel-cart

包简介

A simple Shopping Cart system for e-commerce projects for Laravel.

README 文档

README

A simple Shopping Cart system for e-commerce projects for Laravel.

Installation

First, add ismail1k/laravel-cart package to your laravel project using Composer:

composer require "ismail1k/laravel-cart"

then add these follow lines to config/app.php:

  'providers' => [
      Ismail1k\LaravelCart\ServiceProvider::class,
  ],
  'aliases' => [
      'Cart' => Ismail1k\LaravelCart\CartServiceProvider::class,
  ],

Next step, add some published files like migrations:

php artisan vendor:publish --provider="Ismail1k\LaravelCart\ServiceProvider"

then run the follow line:

php artisan migrate

Usage

Use class Cart using:

use Cart;

Select your cart with:

$cart = Cart::get($cart_token);

Or you can create new one with:

$cart = Cart::create($user_id = null);  //It by default null but if you want to link that created cart to a specified user, You can pass `user_id` parameter.

Add some product to your cart with:

Cart::add($cart_token, $product_id, $quantity = 1); //The default quantity is 1, that means if you don't specify the quantity, 1 will be added automatically.

Note: If you assign 2 to a product that already has 1 quantity, it will be 2, not 3.

Remove one item from cart with:

Cart::removeItem($product_id);

If you want to remove all products from the cart with a single action, you can do so with:

Cart:clear($cart_token);

Or you can destroy cart with:

Cart::destroy($cart_token);

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固