option('branch') ?? 'main'; $this->info("🔄 Switching Nitro to branch: {$branch}"); try { $nitroService = new NitroUpdateService; $result = $nitroService->updateNitro(true); if ($result['success'] ?? false) { $this->info("✅ Switched to {$branch} successfully!"); $this->info($result['message'] ?? ''); Log::info('[NitroSwitch] Success', ['branch' => $branch, 'message' => $result['message'] ?? '']); } else { $this->error('❌ Switch failed: ' . ($result['error'] ?? 'Unknown error')); Log::error('[NitroSwitch] Failed', ['branch' => $branch, 'error' => $result['error'] ?? 'Unknown']); } Cache::forget('website_settings'); SettingsService::clearCache(); return ($result['success'] ?? false) ? 0 : 1; } catch (\Exception $e) { $this->error('❌ Exception: ' . $e->getMessage()); Log::error('[NitroSwitch] Exception', ['branch' => $branch, 'error' => $e->getMessage()]); return 1; } } }