From 84ee654f238e4b655a105d366c4d5eff5a474e5f Mon Sep 17 00:00:00 2001 From: Nikita <62756604+FlamesONE@users.noreply.github.com> Date: Sat, 24 Aug 2024 11:49:24 +0500 Subject: [PATCH] fix edit --- module.json | 2 +- src/Http/Controllers/API/ApiAdminFaqController.php | 4 +++- src/routes.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/module.json b/module.json index bbebe36..6371711 100644 --- a/module.json +++ b/module.json @@ -1,6 +1,6 @@ { "name": "FAQ", - "version": "1.0.0", + "version": "1.0.1", "description": "faq.description", "authors": ["Flames"], "providers": ["Flute\\Modules\\FAQ\\src\\ServiceProviders\\FAQServiceProvider"], diff --git a/src/Http/Controllers/API/ApiAdminFaqController.php b/src/Http/Controllers/API/ApiAdminFaqController.php index 9f4cfb8..a43b38a 100644 --- a/src/Http/Controllers/API/ApiAdminFaqController.php +++ b/src/Http/Controllers/API/ApiAdminFaqController.php @@ -44,8 +44,10 @@ public function delete(FluteRequest $request, $id): Response } } - public function update(FluteRequest $request, $id): Response + public function update(FluteRequest $request): Response { + $id = $request->input('id', 0); + try { $this->faqService->update( (int) $id, diff --git a/src/routes.php b/src/routes.php index 5548132..58b40f4 100644 --- a/src/routes.php +++ b/src/routes.php @@ -17,6 +17,6 @@ $routeGroup->group(function (RouteGroup $adminRouteGroup) { $adminRouteGroup->post('add', [ApiAdminFaqController::class, 'store']); $adminRouteGroup->delete('{id}', [ApiAdminFaqController::class, 'delete']); - $adminRouteGroup->put('{id}', [ApiAdminFaqController::class, 'update']); + $adminRouteGroup->put('edit', [ApiAdminFaqController::class, 'update']); }, 'api/faq/'); }, 'admin/'); \ No newline at end of file