*/ protected $fillable = [ 'name', 'description', 'start_date', 'end_date', 'status', 'location', 'max_teams', 'current_scheduling_mode_id', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'start_date' => 'date', 'end_date' => 'date', ]; /** * Get the teams participating in the competition. */ public function teams(): BelongsToMany { return $this->belongsToMany(Team::class) ->withTimestamps() ->withPivot('status'); } /** * Get the scheduling modes available for this competition. */ public function schedulingModes(): HasMany { return $this->hasMany(SchedulingMode::class); } /** * Get the current scheduling mode for this competition. */ public function currentSchedulingMode() { return $this->belongsTo(SchedulingMode::class, 'current_scheduling_mode_id'); } /** * Get the matches for this competition. */ public function matches(): HasMany { return $this->hasMany(MatchGame::class); } /** * Get the break periods for this competition. */ public function breakPeriods(): HasMany { return $this->hasMany(BreakPeriod::class); } /** * Get the fields used in this competition. */ public function fields(): BelongsToMany { return $this->belongsToMany(Field::class) ->withTimestamps(); } }