'date', ]; /** * The user account for this student */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Parent/guardian of this student */ public function parent(): BelongsTo { return $this->belongsTo(User::class, 'parent_id'); } public function parents(): BelongsToMany { return $this->belongsToMany( ParentProfile::class, 'parent_student', 'student_profile_id', // FK column pointing to THIS model 'parent_profile_id' // FK column pointing to ParentProfile ) ->withPivot('relationship', 'notes') ->withTimestamps(); } /** * Subjects (with teachers) that this student studies */ public function subjects(): HasMany { return $this->hasMany(StudentTeacherSubject::class, 'student_id'); } /** * Attendance records for this student */ public function attendance(): HasMany { return $this->hasMany(LessonAttendance::class, 'student_teacher_subject_id'); } /** * The type of student (online, centre, hybrid, etc) */ public function type(): BelongsTo { return $this->belongsTo(StudentType::class, 'student_type_id'); } public function billingAccount() { return $this->belongsTo(BillingAccount::class); } public function students() { return $this->belongsToMany(StudentProfile::class, 'parent_student') ->withPivot('relationship', 'notes') ->withTimestamps(); } }