api(application): fix database requests returning 404
This commit is contained in:
parent
c7d905fece
commit
0759ecb1e1
4 changed files with 8 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue