How to show value from relation table ? #565
-
|
I have two class Users, Roles |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Since you have "roles" (plural) and also you want to add a Then once you have this, you can use the |
Beta Was this translation helpful? Give feedback.


Since you have "roles" (plural) and also you want to add a
select_multiplefield I would suggest that you makeuserstable with name, email, password, etc. and arolestable withnameand anything else the role itself needs. Then create a connecting table (pivot table) following this guide: https://laravel.com/docs/10.x/eloquent-relationships#many-to-many it even has an example with users and roles :) Do not forget that you should create the database structure properly and also define the proper relationship between the user and the role models - the first two sections in the link I sent - "Table Structure" and "Model Structure".Then once you have this, you can use the
select_mutiplecol…