lundi 25 janvier 2016

Checking Stripe subscription status in 5.2

How is everyone checking their users subscription status in 5.2?

In 5.1 it was easy $user->subscribed(), but now you have to specify a plan name as an argument $user->subscribed('plan-name').

To grab the user's plan name, I created a Subscription model to go along with the subscription table that is created by Cashier. Then created an association between User and Subscription, so I can get a user's plan name like $user->subscription['name'], then I just inserted that into the subscribed call:

$user->subscribed( $user->subscription['name'] )

It looks fine to me, and outputs the plan name in Tinker correctly, but ends up breaking things and throwing this error on some of my routes: Call to undefined method Illuminate\Database\Query\Builder::active()

Thanks for any help!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1WKejVo
via IFTTT

Aucun commentaire:

Enregistrer un commentaire