Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shami003's avatar

Structuring siblings relation on same model

I have student model. I want to add siblings from existing students table on user profile page. I am selecting sibling from a dropdown. Also I want to add the parents of old student(sibling) to the new student(sibling). For student parent I have many-to-many relationship and I am saving student_id and parent_id in pivot table

How can I structure and add this sibling part?

0 likes
1 reply
shami003's avatar

I have created SiblingStudent model and pivot table with student_id and sibling_id. If I am creating student with id 2, and adding student 1 as sibling. so is it necessacry to add both id 1 & 2 in both student_id and sibling_id columns?

Please or to participate in this conversation.