Has model through relation

Posted 3 years ago by canfiax

Say I have the following relationships:

   A Company has many Plan
   A Plan belongs to one Company
   A User has many Subscription
   A Subscription belongs to one Plan

How can I get the Company from a Subscription? I could do something like this:

  $subscription->plan->company

But I would like to do:

 $subscription->company

But I wonder if I could use something like BelongsToThrough (even though that does not exist).

Please sign in or create an account to participate in this conversation.