step === 1) { $this->validate([ 'name' => ['required', 'string', 'min:3', 'max:64'], 'env' => ['required', 'in:prod,staging,edge,dev'], ]); } $this->step = min(4, $this->step + 1); } public function prevStep(): void { $this->step = max(1, $this->step - 1); } public function getSlugProperty(): string { return Str::slug($this->name) ?: 'neuer-cluster'; } public function getMonthlyPriceProperty(): int { $base = match ($this->size) { 'small' => 4900, 'medium' => 9900, 'large' => 24900, default => 9900, }; return ($base * $this->nodes) / 100; } public function create(): void { Cluster::create([ 'workspace_id' => auth()->user()?->current_workspace_id ?? \App\Models\Workspace::factory()->create()->id, 'name' => $this->name, 'slug' => $this->slug, 'region' => $this->region, 'env' => $this->env, 'monthly_price_cents' => $this->monthlyPrice * 100, 'node_count' => $this->nodes, 'backups_enabled' => $this->hourlyBackups, ]); $this->redirect(route('servers.index'), navigate: true); } }; ?>