{"repo":"beyondcode/laravel-vouchers","free":true,"listed":false,"github":"https://github.com/beyondcode/laravel-vouchers","clone":"git clone https://github.com/beyondcode/laravel-vouchers.git","description":"Allow users to redeem vouchers that are bound to models.","language":"PHP","stars":705,"topics":["hacktoberfest","laravel"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"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 content of the published config file: If necessary, you can publish the translation files for further customization: You can access the translations of the package like so: ('vouchers::validation.code invalid') . 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. Creating Vouchers Using the facade You can create one or multiple vouchers by using the Vouchers facade: The return val","default_branch":null,"files":null,"tree":[],"storefront":"/r/beyondcode","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/beyondcode/laravel-vouchers/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}