1
I recently discovered a feature of eloquent
called sync
, I saw that he kind of compares the data passed with the data that’s in the database and deletes or inserts what’s different. I wanted to implement this in my application, but I didn’t understand how.
I have the following table:
id id_setor_empresa id_exame
1 5 3
2 5 20
3 5 17
Which stores which exams should be done by employees of a sector.
Currently when an edition is made, I delete all the sector exams and register the new ones. How can I use the sync
to do this more "clean"?