I have a Many To Many relationship between Council and ManagementUnit. The associated entities change from year to year, so the pivot table is like this:
council_id
management_unit_id
year
My problem is that the same combined council_id + management_unit_id keys can appear several times, so I don't know how to attach() or detach() the models. For example, if I had this:
council_id | management_unit_id | year
1 | 1 | 2010
1 | 1 | 2011
1 | 1 | 2012
how would I detach Council(1) from ManagementUnit(1) only for 2011? or how would I attach a Council(1) to ManagementUnit(1) for 2013?
Working with Laravel 5.1
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire