Download the PHP package teikun-86/laravel-vouchers without Composer
On this page you can find all versions of the php package teikun-86/laravel-vouchers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download teikun-86/laravel-vouchers
More information about teikun-86/laravel-vouchers
Files in teikun-86/laravel-vouchers
Package laravel-vouchers
Short Description For this package there is no description available.
License
Informations about the package laravel-vouchers
Laravel Vouchers 🎟
This package can associate vouchers with your Eloquent models. This might come in handy, if you need to associate voucher codes with content that is stored in your Eloquent models.
Here is an example of how you can create vouchers and redeem them:
Installation
You can install the package via composer:
The package will automatically register itself.
You can publish the migration with:
After the migration has been published you can create the vouchers table by running the migrations:
You can publish the config-file with:
This is the contents of the published config file:
Usage
The basic concept of this package is that you can create vouchers, that are associated with a specific model. For example, you could have an application that sells online video courses and a voucher would give a user access to one specific video course.
Add the BeyondCode\Vouchers\Traits\HasVouchers
trait to all your Eloquent models, that you want to be associated with vouchers.
In addition, add the BeyondCode\Vouchers\Traits\CanRedeemVouchers
trait to your user model. This way users can easily redeem voucher codes and the package takes care of storing the voucher/user association in the database.
php $videoCourse = VideoCourse::find(1);
// Create 5 vouchers associated to the videoCourse model. $vouchers = Vouchers::create($videoCourse, 5); bash composer test
### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Credits
- [Marcel Pociot](https://github.com/mpociot)
- [All Contributors](../../contributors)
This package is heavily based on the Laravel Promocodes package from [Zura Gabievi](https://github.com/zgabievi). You can find the code on [GitHub](https://github.com/zgabievi/laravel-promocodes).
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.