PHPackages                             patinthehat/laravel-vouchers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. patinthehat/laravel-vouchers

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

patinthehat/laravel-vouchers
============================

Allow users to redeem vouchers that are bound to models..

0.2.2(7y ago)04MITPHPPHP ^7.1.3

Since Jul 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/patinthehat/laravel-vouchers)[ Packagist](https://packagist.org/packages/patinthehat/laravel-vouchers)[ Docs](https://github.com/beyondcode/laravel-vouchers)[ RSS](/packages/patinthehat-laravel-vouchers/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (6)Versions (9)Used By (0)

Laravel Vouchers 🎟
==================

[](#laravel-vouchers-)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e54c676e4087459eb776d35804819d13b0f4d64d897d2636545a125e5c7337c1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6265796f6e64636f64652f6c61726176656c2d766f7563686572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/beyondcode/laravel-vouchers)[![Build Status](https://camo.githubusercontent.com/5f6131557edd8206cdd72380f2dbcda81ba4a7bc011b1928766b3f02ef4de8c0/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6265796f6e64636f64652f6c61726176656c2d766f7563686572732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/beyondcode/laravel-vouchers)[![Quality Score](https://camo.githubusercontent.com/4b861d0b6efaade26142b18b25482b28612430a37d2d2bc1f8908203bd582f9d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6265796f6e64636f64652f6c61726176656c2d766f7563686572732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/beyondcode/laravel-vouchers)[![Total Downloads](https://camo.githubusercontent.com/c907709de54871fc9c31ac3b2238999b8e9bf820fcb1c001aef7d8429d72e1f9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6265796f6e64636f64652f6c61726176656c2d766f7563686572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/beyondcode/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:

```
$videoCourse = VideoCourse::find(1);
$voucher = $videoCourse->createVoucher();

auth()->user()->redeemVoucher($voucher);
```

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require beyondcode/laravel-vouchers
```

The package will automatically register itself.

You can publish the migration with:

```
php artisan vendor:publish --provider=BeyondCode\Vouchers\VouchersServiceProvider --tag="migrations"
```

After the migration has been published you can create the vouchers table by running the migrations:

```
php artisan migrate
```

You can publish the config-file with:

```
php artisan vendor:publish --provider=BeyondCode\Vouchers\VouchersServiceProvider --tag="config"
```

This is the contents of the published config file:

```
