*/ use HasFactory; protected static function booted(): void { static::saving(function (self $ticketStatus): void { $ticketStatus->slug = Str::slug($ticketStatus->name); }); } public function allowedSourceStatuses(): BelongsToMany { return $this->belongsToMany( self::class, 'ticket_status_transitions', 'to_ticket_status_id', 'from_ticket_status_id', ) ->orderBy('board_column_id') ->orderBy('position') ->withTimestamps(); } public function allowedTargetStatuses(): BelongsToMany { return $this->belongsToMany( self::class, 'ticket_status_transitions', 'from_ticket_status_id', 'to_ticket_status_id', ) ->orderBy('board_column_id') ->orderBy('position') ->withTimestamps(); } public function boardColumn(): BelongsTo { return $this->belongsTo(BoardColumn::class); } public function project(): BelongsTo { return $this->belongsTo(Project::class); } public function tickets(): HasMany { return $this->hasMany(Ticket::class) ->orderByDesc('sequence_number'); } }