*/ protected $fillable = [ 'name', 'logo', 'nb_players', 'contact_email', 'contact_phone', 'status', ]; /** * Get the competitions this team is participating in. */ public function competitions(): BelongsToMany { return $this->belongsToMany(Competition::class) ->withTimestamps() ->withPivot('status'); } /** * Get the matches where this team is the home team. */ public function homeMatches(): HasMany { return $this->hasMany(MatchGame::class, 'home_team_id'); } /** * Get the matches where this team is the away team. */ public function awayMatches(): HasMany { return $this->hasMany(MatchGame::class, 'away_team_id'); } /** * Get all matches for this team (both home and away). */ public function matches() { return $this->homeMatches->merge($this->awayMatches); } /** * Get the break periods assigned to this team. */ public function breakPeriods(): BelongsToMany { return $this->belongsToMany(BreakPeriod::class) ->withTimestamps(); } }