eldegweydev / coupon
Coupon CRUD Package For Laravel
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires
This package is auto-updated.
Last update: 2025-03-28 20:27:56 UTC
README
This package help you to generate the CRUD for coupon codes and easily apply the coupons and verify it. It offer different types of discounts, Fixed and Percentage discounts.
Installation
First, install Package into your project using the Composer package manager:
composer require eldegweydev/coupon
Run migrations
Finally, run database migration
php artisan migrate
Routes List
Can access the coupons routes from this table
Method | Action | URI |
---|---|---|
GET | index | /coupons |
GET | show | /coupons/{coupon} |
GET | create | coupons/create |
POST | store | /coupons |
GET | edit | /coupons/{coupon}/edit |
PUT | update | /coupons/{coupon} |
DELETE | destroy | /coupons/{coupon} |
Usage
To verify coupon code and apply the discount , you can use the provided Trait Coupon, it has two functions one for check the coupon is active and second to apply the coupon discount
use Eldegweydev\Coupon\Http\Traits\CouponTrait use CouponTrait; $this->checkCouponIsActive($code,$select = ['*']); $this->calculateCouponDiscount($code,$total_price);