samedi 2 décembre 2017

Laravel One To Many Relationship upgrade

I have twoo models:

Student

  • id
  • name

Relationship

  • id
  • student_id
  • sibling_id

A Student can be related to an other Student trough Relationship Model. Everything works fine, but the syncing of the relationship:

When I open the profile form of the student, I list all the relationships of a student(does not matter if the Student's id is in Relationship->student_id or Relationship->sibling_id). When the form is submitted, I got an array whith the new id-s. In normal case this could be saved with the sync method, but how can I in this case? Any idea?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire