HasManyThrough with two pivot tables

Posted 3 years ago by wheredidgogogo

This one is starting to fry my brain...

I have five tables:

users

roles_users (pivot)

roles

permissions_roles (pivot)

permissions

I can't for the life of me create a query that returns the permissions for a given user.

I can get hasmanythrough to work with just one pivot table and a one-to-one relationship for the second step. But I can't get it to work when there are 2 many-to-many relationships.

Any help would be greatly appreciated :)

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

Reply to

Use Markdown with GitHub-flavored code blocks.