承接 autepos/discount-nke-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

autepos/discount-nke-laravel

Composer 安装命令:

composer require autepos/discount-nke-laravel

包简介

Laravel wrapper for autepos/discount

README 文档

README

DiscountNkeLaravel is an implementation of autepos/discount for Laravel. It is designed to be similar to Stripe's Discount which is made up of a coupon and a promotion code. It not quite a wrapper around autepos/discount since it mainly implement the DiscountInstrument and interface and provides the necessary Eloquent models.

Requirements

  • PHP 8.0+
  • Laravel 9.x+

Installation

Install the package via composer:

composer require autepos/discount-nke-laravel

php artisan migrate

Usage

use Autepos\DiscountNkeLaravel\Contracts\DiscountProcessorFactory;
use Autepos\Discount\Contracts\DiscountableDevice;
use Autepos\DiscountNkeLaravel\Models\PromotionCode;

class Order implements DiscountableDevice
{
    //...
}


$discountableDevice = new Order();
$discountInstrument = new PromotionCode::find(1);

$processor = app(DiscountProcessorFactory::class);
$processor->addDiscountableDevice($discountableDevice)
          ->addDiscountInstrument($discountInstrument);
$discountLineList = $processor->calculate();

// Get the discount amount
$discountAmount = $discountLineList->amount();

// Persist the discount
$discountLineList->redeem();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-25