diff --git a/app/Http/Controllers/API/v1/StatusController.php b/app/Http/Controllers/API/v1/StatusController.php index 3a83bba1f..2d19e236e 100644 --- a/app/Http/Controllers/API/v1/StatusController.php +++ b/app/Http/Controllers/API/v1/StatusController.php @@ -289,14 +289,12 @@ public function show(int $id): StatusResource { * } * ) */ - public function destroy(string|int $statusId): JsonResponse { + public function destroy(string|int $statusIdOrUuid): JsonResponse { try { - //TODO: check scope for write-statuses - - if (is_numeric($statusId)) { //TODO: remove this after uuid migration done - $status = Status::findOrFail($statusId); + if (is_numeric($statusIdOrUuid)) { //TODO: remove this after uuid migration done + $status = Status::findOrFail($statusIdOrUuid); } else { - $status = Status::where('uuid', $statusId)->firstOrFail(); + $status = Status::where('uuid', $statusIdOrUuid)->firstOrFail(); } $this->authorize('delete', $status); $status->delete(); diff --git a/routes/api.php b/routes/api.php index b177398dc..6a34d1972 100644 --- a/routes/api.php +++ b/routes/api.php @@ -62,7 +62,7 @@ Route::get('dashboard/future', [StatusController::class, 'getFutureCheckins']); }); Route::group(['middleware' => ['scope:write-statuses']], static function() { - Route::delete('status/{id}', [StatusController::class, 'destroy'])->whereNumber('id'); + Route::delete('status/{id}', [StatusController::class, 'destroy']); Route::put('status/{id}', [StatusController::class, 'update']); Route::post('status/{statusId}/tags', [StatusTagController::class, 'store']); Route::put('status/{statusId}/tags/{tagKey}', [StatusTagController::class, 'update']);