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

gthomas3's avatar

Check Stripe subscription status

I want to add middleware to check if the user has an active Stripe subscription, then allow/restrict access to routes.

In 5.2 they got rid of the very handy $user->subscribed() method, now requiring you to call it with a plan name argument $user->subscribed('plan-name').

How do you get the users plan name to call this method with?

I added a quick hasOne association in my User model to then called the subscribed method like:

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

..which seems like it should work fine, but it was messing up some of my routes and throwing this error: Call to undefined method Illuminate\Database\Query\Builder::active()

Am I going about this the right way, or how does everyone else quickly check if a User has an active subscription? I don't understand why they changed this method to require a plan-name argument..

Thanks for any help!

0 likes
1 reply
Mick79's avatar

Sad that no-one has answered this as I have the same question.

Please or to participate in this conversation.