Browse Source

fix: 🐛 Try Catch for upgrade routing

IceToast 1 year ago
parent
commit
931f08a1d7
1 changed files with 3 additions and 2 deletions
  1. 3 2
      routes/web.php

+ 3 - 2
routes/web.php

@@ -34,6 +34,7 @@ use App\Http\Controllers\TicketsController;
 use App\Http\Controllers\TranslationController;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Route;
 
 /*
@@ -80,10 +81,10 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
     try {
         $serverSettings = app(App\Settings\ServerSettings::class);
         if ($serverSettings->creation_enabled) {
-            Route::resource('servers', ServerController::class);
+            Route::post('servers/{server}/upgrade', [ServerController::class, 'upgrade'])->name('servers.upgrade');
         }
     } catch (Exception $e) {
-        // Do nothing if the settings are not available.
+        Log::error("ServerSettings not found, skipping server upgrade route");
     }
 
     Route::post('profile/selfdestruct', [ProfileController::class, 'selfDestroyUser'])->name('profile.selfDestroyUser');