Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

gthomas3's avatar

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!

0 likes
1 reply
gthomas3's avatar
gthomas3
OP
Best Answer
Level 1

Just an issue with the model I created called Subscription and it's hasOne association from User called subscription. This is a reserved word that was creating a collision, and then the QueryBuilder errors noted in the question.

I simply changed the model name that references the subscriptions table to StripeSubscription (include a $table = 'subscriptions' property in the Model), and also the association from User to stripeSubscription.

Then you're able to call the Cashier function, like:

$user->subscribed( $user->stripeSubscription['name'] );

Please or to participate in this conversation.