Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/code4mk/lara-coupon
easily create laravel coupon code with with lara-coupon :heart: @code4mk
https://github.com/code4mk/lara-coupon
code4mk coupon laravel laravel-coupon laravel-promo laravel-vouchar promo-code vouchar
Last synced: 1 day ago
JSON representation
easily create laravel coupon code with with lara-coupon :heart: @code4mk
- Host: GitHub
- URL: https://github.com/code4mk/lara-coupon
- Owner: code4mk
- Created: 2019-05-01T17:47:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-05T16:09:52.000Z (over 5 years ago)
- Last Synced: 2024-04-05T10:44:29.107Z (7 months ago)
- Topics: code4mk, coupon, laravel, laravel-coupon, laravel-promo, laravel-vouchar, promo-code, vouchar
- Language: PHP
- Homepage: https://code4mk.org
- Size: 14.6 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# lara-coupon
easily create laravel coupon code with with lara-coupon# installation
```bash
composer require code4mk/lara-coupon
```# setup
## 1) vendor publish
```bash
php artisan vendor:publish --provider="Code4mk\LaraCoupon\LaraCouponServiceProvider" --tag=config
php artisan vendor:publish --provider="Code4mk\LaraCoupon\LaraCouponServiceProvider" --tag=migrations
```## 2) config
* `config/laraCoupon.php`
* setup `expired time`,`prefix`,`code length`
* `expire time ` must be follow [P7Y5M4DT4H3M2S](https://www.php.net/manual/en/datetime.add.php)```php
"expired" => "PT12M",
"isCodePrefix" => true,
"codePrefix" => "PMM-",
"codeLenght" => 10
```* `php artisan config:clear`
# method
## `create()`
```php
use KCoupon;
KCoupon::create($authUser)
```* create method has more request data
* `code,quantity,type,amount,product_id,user_id,rsingle,description`
* if you want auto code that time don't use `code` in request query* if coupon code will need quantity that time use request query `quantity=integer` as `?quantity=20`
* type is fix or per (percent) `?type=fix` , `?type=per`
* amount `?amount=120`, `?amount=10`
* specific product's coupon `?product_id=12`
* specific user's coupon `?user_id=2`
* redeem one user only one time `?rsingle=true`
* all products coupon for all user
* without query `product_id,user_id`## `singleRedeem()`
```php
use KCoupon;
KCoupon::singleRedeem($code, $authUser)
```## `singleUnredeem()`
```php
use KCoupon;
KCoupon::singleUnredeem($code, $authUser)
```## `redeem()`
```php
use KCoupon;
KCoupon::redeem($code)
```## `unredeam()`
```php
use KCoupon;
KCoupon::unredeam($code)
```## lists
```php
use KCoupon;
KCoupon::lists();
```## activeLists
```php
use KCoupon;
KCoupon::activeLists();
```## deactiveLists
```php
use KCoupon;
KCoupon::deactiveLists();
```## general
```php
use KCoupon;
KCoupon::general();
```## `delete`
```php
use KCoupon;
KCoupon::delete($code);
```## `check`
```php
use KCoupon;
KCoupon::check($code,$authUser);
```* check return
```php
"status" => ,
"type" => ,
"is_product" => ,
"is_user" => ,
"is_quantity" => ,
"is_rsingle" => ,
"amount" =>
```