belongsTo(User::class); } /** * Subjects this teacher teaches */ public function subjects(): BelongsToMany { return $this->belongsToMany(Subject::class, 'level_subject_teacher') ->withPivot('level_id'); // since we’re also tracking level } /** * Levels this teacher teaches */ public function levels(): BelongsToMany { return $this->belongsToMany(Level::class, 'level_subject_teacher') ->withPivot('subject_id'); } public function teachingArrangements(): HasMany { return $this->hasMany(TeachingArrangement::class, 'teacher_id'); } public function payPeriods(): HasMany { return $this->hasMany(TeacherPayPeriod::class, 'teacher_id'); } }