'array', 'is_active' => 'boolean', ]; // Генерирует уникальный slug из заголовка public static function generateSlug(string $title, ?int $exceptId = null): string { $base = Str::slug($title); $slug = $base; $i = 1; while ( static::where('slug', $slug) ->when($exceptId, fn (Builder $q) => $q->where('id', '!=', $exceptId)) ->exists() ) { $slug = $base . '-' . $i++; } return $slug; } // Scope: только активные услуги public function scopeActive(Builder $query): Builder { return $query->where('is_active', true); } }