Approach pivot or relationship please?
Hello. I need help to study the right approach, please.
I have a dossier model for inheritance records (to introduce all the data of an inheritance action) which has a hasMany relationship with interveners (people who will inherit somehing) and aso a hasMany relationship with goods (things to be inherited).
I have already done that and I can add many interveners and many goods with a repeater in each case and saving the records in the relational tables.
Now I have to let the user match every intervener with every good to give a percentage of inherit.
My first idea was this:
Intervener_id - Goods_id - Percentage
1 - 1 - 0%
1 - 2 - 75%
2 - 2 - 25%
3 - 1 - 100%
Would you recommenda pivot table or maybe a different relationship type?
I would like to have all x all fields in a kind of table, I mean, all goods in columns and all interveners in rows and every match point should have a percentage, considering many can be zero and maximum sum of percentages of a goods id to inherit is 100%.
I will be very grateful to hear any ideas from you, people, on the best approach.
Tks.
2 Replies
I think I would go with a pivot table, like
intervener_good
.
Probably even an IntervenerGood
pivot model. I think you'll need it to create the table UI to assign all percentages.Ok. Thank you.
I'll try to go that way and see whether with a repeater section it works fine.