The two tables sites and terms have many to many relationship. The pivot table for them is:
site_terms
----------
site_id
term_id
While saving a site and its relationship with the terms work fine with the following:
$site->terms()->attach($term_id);
Say I have added a site to a term and the record is in the table:
site_term
-----------
site_id term_id
101 501
When I edit the site and add a different term whose id is 502 how can I update the record of the relationship in the pivot table so that the record is now
site_term
-----------
site_id term_id
101 502
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire