diff --git a/src/Http/Controllers/MediaController.php b/src/Http/Controllers/MediaController.php index 332a54c1..9b5cc933 100644 --- a/src/Http/Controllers/MediaController.php +++ b/src/Http/Controllers/MediaController.php @@ -5,6 +5,7 @@ use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; class MediaController extends Controller { @@ -27,6 +28,7 @@ public function __invoke(Request $request): JsonResponse 'GET' => new JsonResponse($field->paginate($request, $model)), 'POST' => new JsonResponse($field->upload($request, $model), JsonResponse::HTTP_CREATED), 'DELETE' => new JsonResponse(['deleted' => $field->prune($request, $model, $request->input('ids', []))]), + default => throw new MethodNotAllowedHttpException(['GET', 'POST', 'DELETE']), }; } }