Download the PHP package ashadozzaman/coupon without Composer
On this page you can find all versions of the php package ashadozzaman/coupon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ashadozzaman/coupon
More information about ashadozzaman/coupon
Files in ashadozzaman/coupon
Package coupon
Short Description This package generate coupon/discount for any kinds of course or product...
License MIT
Informations about the package coupon
Laravel Coupon 🎟
This package generate coupon/discount for any kinds of course or product selling website...🎟
Here is an example of how you can create coupon them:
Installation
You can install the package via composer:
Now you should register CouponServiceProvider in config/app.php
The package will automatically register itself.
You can publish the migration with below command, it's copy generate file config/coupon.php also crate folde views/vendor/coupon for create coupon, it you want you can change all file design. But don't cut form structure...
config/coupon.php file show bellow. here you set you necessary information
After the migration has been published you can create the vouchers table by running the migrations:
Usage
The basic concept of this package is that you can create coupon by admin for specific course/product and course/product category. For access this feature you declure your admin authentication middleware in config/coupon.php file like bellow:-
Model Declare
You must be declare your coupon related items models like products/coures and categories table model example show bellow:-
After complete middleware register. Now you able to access create coupon in you admin section. Now you just call two route for creating coupon. Two route show bellow:-
Admin coupon create process done here
Use Coupon In Frontend 🎟
Coupon use basically in your checkout page. So you just use coupon easily in checkout page with same route. Show example bellow code:-
route/web.php (It's only example, you write code in your own way)
Http/Controllers/HomeController.php (It's only example, you write code in your own way)
In controller must be use bellow Trait:-
This function is work in my side. It's show for example perpose.
Using this trait function check coupon status, for use coupon time. Must be pass necesary all perameter. This function return response in array. In array pass two type status 1. success 2. error.
Response example bellow show:-
checkout.blade.php (It's only example, you write code in your own way)
After use coupon, when you submit checkout form that's mean when you save checkout details. You must be call bellow trail function:-
Using this function store coupon used user and coupon code. So must be call this after save checkout details. Bellow show details example:-
Respone example show bellow:-
Contributor
Ashadozzaman Shvou([email protected])
Support
For any query please send email to [email protected]
License
The MIT License (MIT). Please see License File for more information.