If the question is not StackOverflow-y I don't mind moderators to close it, I couldn't decide.
I have the following models: Users, Groups, Regions, Cities... There are like 4 of them. Every user can have multiple relations to each entity (administrator, manager, participant and some others)
Should I do a Relations table as follows:
user_id | target_id | target_type | relationship_type
1 | 2 | group | manager
And if so - how would I use Eloquent relations - HasManyThrough somehow?
Or is the Eloquent way something else? Maybe different tables for each entity (user_group, user_region)
?
The goal is to have each "Groups where Peter is admin in", "Regions where Jessica is participant" queried easily via Eloquent.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire