'json']; public function entry(): BelongsTo { return $this->belongsTo(Entry::class); } public function judge(): BelongsTo { return $this->belongsTo(User::class, 'user_id'); } public function audition(): HasOneThrough { return $this->hasOneThrough( Audition::class, // The final model you want to access Entry::class, // The intermediate model 'id', // Foreign key on the intermediate model (Entry) 'id', // Foreign key on the final model (Audition) 'entry_id', // Local key on the current model (ScoreSheet) 'audition_id' // Local key on the intermediate model (Entry) ); } public function getSubscore($id) { return $this->subscores[$id]['score'] ?? false; } public function isValid() { // TODO move to either TabulationService or a specific service for scoreValidation $judges = $this->audition->judges; return $judges->contains('id', $this->judge->id); } }