*/ protected $fillable = [ 'user_id', 'match_id', 'selection', 'submitted_at', ]; protected function casts(): array { return [ 'selection' => MatchOutcome::class, 'points_awarded' => 'integer', 'submitted_at' => 'datetime', 'graded_at' => 'datetime', ]; } public function user(): BelongsTo { return $this->belongsTo(User::class); } public function fixture(): BelongsTo { return $this->belongsTo(Fixture::class, 'match_id'); } public function isCorrect(): bool { return $this->fixture?->result !== null && $this->selection === $this->fixture->result; } }