简体   繁体   中英

Relationship with attribute laravel 8 [closed]

I want make relationship with attribute but i dont understand how to do that with laravel ORM Eloquent, can somebody help me? Thanks in advance

关系图图像

If I'm not mistaken, you want to have a many-to-many relationship between your Mahasiswa and Team . Basically, it means that you have many teams, and each teams has its own members, so does members, each member can have teams. So you will need an intermediate/a pivot table between those two, for ex. mahasiswa_team . Then, inside mahasiswa_team table, you could add the role column to define each member's role.

For many-to-many relationship inside Laravel 8, you can see the documentation here .

If many-to-many relationship is not correct, then my last guess is you want the one-to-many relationship between Team and Mahasiswa . In that case, you want to move your role column to the Mahasiswa table. For one-to-many relationship, you can see the documentationhere .

这里您可以获得所有必要的信息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM