Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mpociot committed Jul 6, 2018
1 parent 87f6c9f commit 6740181
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Expand Up @@ -187,6 +187,16 @@ $user->redeemVoucher($voucher);
After a user successfully redeemed a voucher, this package will fire a `BeyondCode\Vouchers\Events\VoucherRedeemed` event. The event contains the user instance and the voucher instance.
You should listen to this event in order to perform the business logic of your application, when a user redeems a voucher.

### Accessing the vouchers associated model

The `Voucher` model has a `model` relation, that will point to the associated Eloquent model:

```php
$voucher = $user->redeemCode('ABCD-EFGH');

$videoCourse = $voucher->model;
```

## Handling Errors

The `redeemCode` and `redeemVoucher` methods throw a couple of exceptions that you will want to catch and react to in your application:
Expand Down

0 comments on commit 6740181

Please sign in to comment.