Single Model with belongsToMany : How to query?

Posted 2 months ago by yougotnet

I have users who own Accounts (Account Model) and I have users who share accounts with other users by way of Many to Many Relationship (account_user table).

Does Eloquent provide an easy way to retrieve the accounts for a particular user that includes the accounts he owns and the accounts that are shared with him?

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.