Reputation: 2245
Reading Laravel 6 eloquent-relationships docs at https://laravel.com/docs/6.x/eloquent-relationships#one-to-one I did not catch what is “pivot table” and which is practical use of it working with db in laravel ?
Thanks!
Upvotes: 0
Views: 70
Reputation: 522
Think you have two tables like users
, and roles
if you want to make a relationship between them then you need to declare Many To Many
relationships because the single role have many users and single users have many roles. for defining Many To Many
relationships between them you need to create role_user
table, here role_user
table means pivot table
.
for more information please read this Many To Many relationships from laravel documentation
Upvotes: 3