From 0759ecb1e175538309740c9375524e7302690a9b Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Sat, 9 Jan 2021 09:38:50 -0700 Subject: [PATCH] api(application): fix database requests returning 404 --- .../Api/Application/Databases/DeleteDatabaseRequest.php | 4 ++-- .../Api/Application/Databases/GetDatabaseRequest.php | 4 ++-- .../Api/Application/Databases/UpdateDatabaseRequest.php | 2 +- routes/api-application.php | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Http/Requests/Api/Application/Databases/DeleteDatabaseRequest.php b/app/Http/Requests/Api/Application/Databases/DeleteDatabaseRequest.php index 83e31df10..3281f8767 100644 --- a/app/Http/Requests/Api/Application/Databases/DeleteDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Databases/DeleteDatabaseRequest.php @@ -25,8 +25,8 @@ class DeleteDatabaseRequest extends ApplicationApiRequest */ public function resourceExists(): bool { - $database = $this->route()->parameter('database'); + $databaseHost = $this->route()->parameter('databaseHost'); - return $database instanceof DatabaseHost && $database->exists; + return $databaseHost instanceof DatabaseHost && $databaseHost->exists; } } diff --git a/app/Http/Requests/Api/Application/Databases/GetDatabaseRequest.php b/app/Http/Requests/Api/Application/Databases/GetDatabaseRequest.php index ba679b5aa..3e2912340 100644 --- a/app/Http/Requests/Api/Application/Databases/GetDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Databases/GetDatabaseRequest.php @@ -13,8 +13,8 @@ class GetDatabaseRequest extends GetDatabasesRequest */ public function resourceExists(): bool { - $database = $this->route()->parameter('database'); + $databaseHost = $this->route()->parameter('databaseHost'); - return $database instanceof DatabaseHost && $database->exists; + return $databaseHost instanceof DatabaseHost && $databaseHost->exists; } } diff --git a/app/Http/Requests/Api/Application/Databases/UpdateDatabaseRequest.php b/app/Http/Requests/Api/Application/Databases/UpdateDatabaseRequest.php index 4c689696a..7561713c1 100644 --- a/app/Http/Requests/Api/Application/Databases/UpdateDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Databases/UpdateDatabaseRequest.php @@ -15,6 +15,6 @@ class UpdateDatabaseRequest extends StoreDatabaseRequest */ public function rules(array $rules = null): array { - return $rules ?? DatabaseHost::getRulesForUpdate($this->route()->parameter('database')->id); + return $rules ?? DatabaseHost::getRulesForUpdate($this->route()->parameter('databaseHost')->id); } } diff --git a/routes/api-application.php b/routes/api-application.php index f6554be7e..08d8a54c9 100644 --- a/routes/api-application.php +++ b/routes/api-application.php @@ -14,13 +14,13 @@ Route::get('/version', 'VersionController'); */ Route::group(['prefix' => '/databases'], function () { Route::get('/', 'Databases\DatabaseController@index'); - Route::get('/{database}', 'Databases\DatabaseController@view'); + Route::get('/{databaseHost}', 'Databases\DatabaseController@view'); Route::post('/', 'Databases\DatabaseController@store'); - Route::patch('/{database}', 'Databases\DatabaseController@update'); + Route::patch('/{databaseHost}', 'Databases\DatabaseController@update'); - Route::delete('/{database}', 'Databases\DatabaseController@delete'); + Route::delete('/{databaseHost}', 'Databases\DatabaseController@delete'); }); /*