repulsor
3 months ago

Laravel Relations

Posted 3 months ago by repulsor

Trying hard to figure this out.

I have 3 tables.

1.Users (id,name) 2.Roles (id,role_id,role) 3.User_roles (id,user_id,role_id)

User may or may not have more than one role.

Which all relations should I be using?

What I want as a result is this

id,Name,role_id,role (+ other fields) These 4 are the required ones.

I have gone through the docs, but it seems too confusing. Please point me in the right direction. I would really appreciate few lines of how to do instead of direct linking. Thanks a ton. Any help is highly appreciated

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