Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardojbaez committed Aug 23, 2016
1 parent 2b5e18a commit a05031d
Showing 1 changed file with 38 additions and 20 deletions.
58 changes: 38 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@ SaaS style recurring plans for Laravel 5.2.

> Please note: this package doesn't handle payments.
<!-- MarkdownTOC depth=3 autolink=true bracket="round" -->
<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->

- [Installation](#installation)
- [Composer](#composer)
- [Service Provider](#service-provider)
- [Config file and Migrations](#config-file-and-migrations)
- [Traits and Contracts](#traits-and-contracts)
- [Composer](#composer)
- [Service Provider](#service-provider)
- [Config file and Migrations](#config-file-and-migrations)
- [Traits and Contracts](#traits-and-contracts)
- [Usage](#usage)
- [Create a Plan](#create-a-plan)
- [Subscribe User to a Plan](#subscribe-user-to-a-plan)
- [Check plan limitations](#check-plan-limitations)
- [Record Feature Usage](#record-feature-usage)
- [Clear User Subscription Usage](#clear-user-subscription-usage)
- [Check User Subscription Status](#check-user-subscription-status)
- [Renew User Subscription](#renew-user-subscription)
- [Cancel Subscription](#cancel-subscription)
- [Get User Subscription](#get-user-subscription)
- [Get User Subscription Plan](#get-user-subscription-plan)
- [Plan Model Scopes](#plan-model-scopes)
- [Subscription Model Scopes](#subscription-model-scopes)
- [Create a Plan](#create-a-plan)
- [Subscribe User to a Plan](#subscribe-user-to-a-plan)
- [Check plan limitations](#check-plan-limitations)
- [Record Feature Usage](#record-feature-usage)
- [Reduce Feature Usage](#reduce-feature-usage)
- [Clear User Subscription Usage](#clear-user-subscription-usage)
- [Check User Subscription Status](#check-user-subscription-status)
- [Renew User Subscription](#renew-user-subscription)
- [Cancel Subscription](#cancel-subscription)
- [Get User Subscription](#get-user-subscription)
- [Get User Subscription Plan](#get-user-subscription-plan)
- [Subscription Model Scopes](#subscription-model-scopes)
- [Models](#models)
- [Config File](#config-file)

<!-- /MarkdownTOC -->
<!-- /TOC -->


## Installation
Expand Down Expand Up @@ -172,12 +172,30 @@ $user = Auth::user();
// Increment usage by 1
$user->planSubscription->recordUsage('listings_per_month');

// -or-

// Increment usage by custom number (perfect when user perform batch actions)
$user->planSubscription->recordUsage('listings_per_month', 3);

// Set fixed amount
$user->planSubscription->recordUsage('listings_per_month', 5, false);

```

### Reduce Feature Usage

```php
<?php

use Auth;

$user = Auth::user();

// Reduce usage by 1
$user->planSubscription->reduceUsage('listings_per_month', 1);

// Reduce usage by custom number
$user->planSubscription->reduceUsage('listings_per_month', 3);
```

### Clear User Subscription Usage

You may want to reset all feature's usage data when user renew his subscription, in this case the `clearUsage()` function will help you:
Expand Down

0 comments on commit a05031d

Please sign in to comment.