Download the PHP package aberkanidev/laravel-coupons without Composer
On this page you can find all versions of the php package aberkanidev/laravel-coupons. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aberkanidev/laravel-coupons
More information about aberkanidev/laravel-coupons
Files in aberkanidev/laravel-coupons
Package laravel-coupons
Short Description Coupon generator for Laravel
License MIT
Homepage https://github.com/aberkanimed/laravel-coupons
Informations about the package laravel-coupons
Laravel Coupons
Laravel coupons is a package that allows you to add coupons system to your laravel app. The coupons can be associated with Eloquent models, and they can be redeemed by any Eloquent model you choose, not only User model.
Here is an example:
Table of content
- Installation
- Usage
- License
Installation
Install the package via composer
To publish the migration run:
To publish config file run:
Config file example:
Usage
To use this package you have to add this trait aberkanidev\Coupons\Traits\HasCoupons
to the Eloquent models that will be associated to coupons.
Also, you have to add aberkanidev\Coupons\Traits\CanRedeemCoupons
to the Eloquent models that can redeem coupons (For example: User, Customer, ...).
Create coupons
Code example:
Create disposable Coupon
Create Coupons with additional data
Create Coupons with expiry dates:
Redeem Coupon code
You have two ways to redeem a coupons, using the code, or the Coupon Model
If the code is valid it will return the Coupon model.
Redeem Coupon model
This action (redeeming coupons) fires aberkanidev\Coupons\Events\CouponRedeemed
event.
Access the model associated to the Coupon model
License
Laravel coupons is licensed under a MIT License.