ricadesign/laravel-coupon 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ricadesign/laravel-coupon

Composer 安装命令:

composer require ricadesign/laravel-coupon

包简介

Laravel Coupon

README 文档

README

This composer package offers a setup to redeem coupon codes on ecommerce sites. It enables the use of several types of discounts, while offering the possibility of limiting user redemption by different means.

Installation

Begin by pulling in the package through Composer.

composer require ricadesign/laravel-coupon

Next, if using Laravel 5, include the service provider within your config/app.php file. From version 5.5 and thanks to package autodiscovery this is no longer necesary.

'providers' => [
    Ricadesign\LaravelCoupon\LaravelCouponServiceProvider::class,
];

Publishing migrations

In order for the package to work, the migrations included need to be published with the following command:

php artisan vendor:publish

Then you can run them with:

php artisan migrate

Usage

Once installed a registered user will be able to send a GET petition to /coupon?discount={COUPON_CODE}. Either a valid coupon or a 404 error response will be returned.

The RicaDesign\LaravelCoupon\Coupon model also provides the following methods:

Method Params Returns Description
static findAndValidate couponCode, subtotal, itemsCount A valid coupon model or null
getDiscount subtotal Amount to be subtracted from subtotal (positive)
use userId void Increments times_used field, adds entry to user_coupon table (if needed)

Coupon properties

Property Description
value_discount Value to discount in coupon type FixPrice
code_name Codigo de descuento

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2020-07-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固