Initial commit

This commit is contained in:
root
2026-05-09 17:28:23 +02:00
commit 9d73f82529
5575 changed files with 281989 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
<?php
namespace App\Console\Commands;
use App\Services\NitroUpdateService;
use App\Services\SettingsService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
class SwitchNitroBranch extends Command
{
#[\Override]
protected $signature = 'app:switch-nitro-branch {--branch=main}';
#[\Override]
protected $description = 'Switch Nitro to a specific branch (runs in background)';
public function handle(): int
{
$branch = $this->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;
}
}
}