Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jgreen's avatar

Pivot Table w/ data

I have a pivot table that binds users to groups call group_user that currently has group_id and user_id foreign keys pointing back to groups and users tables respectively. Turns out, I know have to support some legacy userids that will be 1:1 on the existing relationship to the legacy userid. My first thought is to tuck these legacy userids in this pivot table. But how do I access/inserts/update/delete the legacy userid if its part of the pivot table since I don't have a model for the pivot.

The other options is to create a three way pivot table and have a table that just has the legacy user ids. However, I'm having issue wrapping my head around how eloquent works with three way pivots as well.

Any pointers or tips?

0 likes
1 reply
jgreen's avatar

so i guess what I want to know is how to implement a many-many-one (user-group-legacyuser) relationship

Please or to participate in this conversation.