29.07.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Laravel Cashier 178<br />

The onPlan method may be used to determine if the user is subscribed to a given plan based on its<br />

Stripe ID:<br />

.<br />

1 if ($user->onPlan('monthly')) {<br />

2 //<br />

3 }<br />

Cancelled Subscription Status<br />

To determine if the user was once an active subscriber, but has cancelled their subscription, you may<br />

use the cancelled method:<br />

.<br />

1 if ($user->cancelled()) {<br />

2 //<br />

3 }<br />

You may also determine if a user has cancelled their subscription, but are still on their “grace period”<br />

until the subscription fully expires. For example, if a user cancels a subscription on March 5th that<br />

was originally scheduled to expire on March 10th, the user is on their “grace period” until March<br />

10th. Note that the subscribed method still returns true during this time.<br />

.<br />

1 if ($user->onGracePeriod()) {<br />

2 //<br />

3 }<br />

The everSubscribed method may be used to determine if the user has ever subscribed to a plan in<br />

your application:<br />

.<br />

1 if ($user->everSubscribed()) {<br />

2 //<br />

3 }

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!