belongsTo(Student::class); } public function audition(): BelongsTo { return $this->belongsTo(Audition::class); } public function school(): HasOneThrough { return $this->hasOneThrough( School::class, Student::class, 'id', 'id', 'student_id', 'school_id'); } public function scoreSheets(): HasMany { return $this->hasMany(ScoreSheet::class); } public function scoreFromJudge($user): ScoreSheet|null { return $this->scoreSheets()->where('user_id','=',$user)->first() ?? null; } }