From 3d740907dbf04506e2421970277288a00f2f47e4 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Wed, 20 Mar 2024 03:02:35 -0400 Subject: [PATCH] This is no longer needed --- app/Http/Middleware/Api/Client/SubstituteClientBindings.php | 3 --- routes/api-client.php | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/Http/Middleware/Api/Client/SubstituteClientBindings.php b/app/Http/Middleware/Api/Client/SubstituteClientBindings.php index 34e41d89b..f17439e28 100644 --- a/app/Http/Middleware/Api/Client/SubstituteClientBindings.php +++ b/app/Http/Middleware/Api/Client/SubstituteClientBindings.php @@ -17,9 +17,6 @@ class SubstituteClientBindings extends SubstituteBindings public function handle($request, Closure $next): mixed { // Override default behavior of the model binding to use a specific table column rather than the default 'id'. - $this->router->bind('server', function ($value) { - return $this->server->query()->where(strlen($value) === 8 ? 'uuidShort' : 'uuid', $value)->firstOrFail(); - }); $this->router->bind('user', function ($value, $route) { /** @var \App\Models\Subuser $match */ diff --git a/routes/api-client.php b/routes/api-client.php index af20e9bd4..1cf518632 100644 --- a/routes/api-client.php +++ b/routes/api-client.php @@ -51,7 +51,7 @@ Route::prefix('/account')->middleware(AccountSubject::class)->group(function () | Endpoint: /api/client/servers/{server} | */ -Route::prefix('/servers/{server}')->middleware(ServerSubject::class, AuthenticateServerAccess::class, ResourceBelongsToServer::class)->group(function () { +Route::prefix('/servers/{server:uuid}')->middleware([ServerSubject::class, AuthenticateServerAccess::class, ResourceBelongsToServer::class])->group(function () { Route::get('/', [Client\Servers\ServerController::class, 'index'])->name('api:client:server.view'); Route::get('/websocket', Client\Servers\WebsocketController::class)->name('api:client:server.ws'); Route::get('/resources', Client\Servers\ResourceUtilizationController::class)->name('api:client:server.resources');