moirei / laravel-vouchers
Manage ecommerce vouchers
Installs: 2 188
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 2
Forks: 8
Open Issues: 12
Requires
- php: ^8.1
- illuminate/config: ^8|^9
- illuminate/database: ^8|^9
- illuminate/support: ^8|^9
- laravel/framework: ^8|^9
Requires (Dev)
- laravel/legacy-factories: ^1.3
- mockery/mockery: ^1.5
- orchestra/testbench: ^7.5
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.2
- phpunit/phpunit: ^9.5
- spatie/pest-plugin-test-time: ^1.1
- thled/pest-plugin-shorthands: ^1.1
- dev-master
- 3.0.1
- 3.0.0
- 2.1.0
- 2.0.0
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- dev-dependabot/npm_and_yarn/minimist-1.2.8
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/qs-6.5.3
- dev-dependabot/npm_and_yarn/terser-4.8.1
- dev-dependabot/npm_and_yarn/eventsource-1.1.1
- dev-dependabot/npm_and_yarn/url-parse-1.5.10
- dev-dependabot/npm_and_yarn/async-2.6.4
This package is auto-updated.
Last update: 2025-02-22 23:19:33 UTC
README
An ecommerce voucher generator. It associates vouchers with one or more eloquent model and allows multiple models to own/redeem vouchers.
✔️ Requirements
- Laravel ^8
- PHP ^8.1
Documentation
All documentation is available at the documentation site.
💚 Unique Features
- Associate one voucher with one or more items
- Flexible redeemer models: vouchers can be redeemed by any model.
User
,Admin
,Guest
models. - Flexible voucher models: voucher can be associated with any model.
Product
,Variant
,Ticket
, whatever else. - Use vouchers once or multiple times
- Limit access: can define model instances that are allowed or excluded from redeeming a Voucher
- Multiple limit scheme; exhaust redeems per instance, per user or per product
Example usage:
$product = Product::find(1); $voucher = $product->createVoucher(); $user->redeem($voucher);
Installation
You can install the package via composer:
composer require moirei/laravel-vouchers
Next publish the migration with
php artisan vendor:publish --tag="vouchers-migrations"
Then run the migrations:
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="vouchers-config"
Notes
- The
allow_models
anddeny_models
attributes mentioned above are actually saved ascan_redeem
andcannot_redeem
internally. They are mutated on boot creating or updating. - If you manage your resources with Nova, Nova Multiselect can be used directly with the
can_redeem
andcannot_redeem
attributes. Example code here.
Credits
License
The MIT License (MIT). Please see License File for more information.