*/ protected function casts(): array { return [ 'starts_at' => 'datetime', 'picks_lock_at' => 'datetime', 'status' => MatchStatus::class, 'home_score' => 'integer', 'away_score' => 'integer', 'result' => MatchOutcome::class, 'result_declared_at' => 'datetime', ]; } public function homeTeam(): BelongsTo { return $this->belongsTo(Team::class, 'home_team_id'); } public function awayTeam(): BelongsTo { return $this->belongsTo(Team::class, 'away_team_id'); } public function picks(): HasMany { return $this->hasMany(Pick::class, 'match_id'); } public function isOpenForPicks(): bool { $lockAt = $this->picks_lock_at ?? $this->starts_at; return $this->status === MatchStatus::Scheduled && $lockAt !== null && $lockAt->isFuture(); } }