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

rojonunoo's avatar

Quick breifing Eloquent Relationships

i have subject model , student's model and class model

  1. students belong to many Class and a Class belongs to a student too.
  2. a subject belongs to a Class and a has many Subjects Now in the subject Table i have subject_name and score (cos i want to keep score of all subject of a particular subject of a student ) but now i have created the relationship between the subject and the class and also how do i make a student have all subjects that the grade has i am stuck now .. cos if i attach subjects to a student one by one it is possible that a student might not have a subject that his/her class has .. i hope its clear enough i need your help please... :(..
0 likes
2 replies
rojonunoo's avatar

@jlrdw Yes i have just gone through but i can't seem to understand what the best way of going around this issue .. :(

Please or to participate in this conversation.