Installation
Requirements
- PHP
^8.2 - Laravel
^11.0 | ^12.0 laravel/sanctumfor the default admin-API authentication
The package works in any Laravel application. Installed on top of the Laravel API Boilerplate it auto-wires into the existing admin stack.
Install
composer require mrsuner/laravel-coupon
php artisan vendor:publish --tag=coupon-config
php artisan migrate
The service provider is auto-discovered. It registers the migrations, binds
the CouponService singleton, and mounts the admin API routes.
What gets installed
Two migrations are published into your schema:
coupon_codes— the redeemable codes, their effect (type+value), usagerestrictions, a runningtimes_redeemedcounter, anis_activeflag and soft deletes.coupon_redemptions— one row per successful redemption, with a polymorphicredeemable, asnapshotof the coupon at redemption time, and optionalcontext.
The
snapshotcolumn freezes the coupon’stypeandvalueat the moment of redemption, so historical records stay accurate even if the coupon is edited later.
Verify
php artisan migrate:status
You should see the two coupon migrations applied. Resolve the service anywhere to confirm the binding:
$coupons = app(\Mrsuner\Coupon\Services\CouponService::class);
Continue with Configuration.