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 |
ricadesign/laravel-coupon 适用场景与选型建议
ricadesign/laravel-coupon 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 578 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 07 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ricadesign/laravel-coupon 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ricadesign/laravel-coupon 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 578
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2020-07-28