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

skattabrain's avatar

How to extend Cashier subscription model

Hello all,

I'm trying to extend Cashier a bit. Basically, I have a "packages" table that contains details about subscriptions. So in packages, I will define a title, the stripe subscription id and package specific details like "allowed_items". When placing an order, I get the availalbe packages and use the stripe_plan to subscribe the user to the plan.

So if I have a package like...

stripe_plan = 'basic', title = "The Basic Plan" and allowed_items = 10

After using Cashier to attach the subscriptions, I would like to be able to use Eloquent by using a HasOne on the Subscription model so I could do something like...

$allowed_items = User::find(3)->subscription('basic')->allowed_items(); // 10

Thanks for any insight. Having trouble extending Cashier's subscription model.

0 likes
0 replies

Please or to participate in this conversation.