$response->json(Result::error('RentArea Creation Failed.')); } }); $this->respond(['GET', 'POST'], '/get/[i:id]', function ($request, $response, $service, $app) { $id = $request->param('id'); $result = RentAreas::getRentArea($id); if ($result) { $response->json(Result::success('', $result)); } else { $response->json(Result::error('RentArea not found')); } }); $this->respond(['GET', 'POST'], '/edit/[:id]', function ($request, $response, $service, $app) { $id = $request->param('id'); $data = json_decode($request->body()); $result = RentAreas::updateRentArea($id, $data); if ($result > 0) { $response->json(Result::success('RentArea Updated.')); } elseif ($result === 0) { $response->json(Result::success('RentArea not Updated.')); } else { $response->json(Result::error('RentArea not found')); } }); $this->respond(['GET', 'POST'], '/delete/[:id]', function ($request, $response, $service, $app) { $id = $request->param('id'); $result = RentAreas::deleteRentArea($id); if ($result > 0) { $response->json(Result::success('RentArea Deleted.')); } else { $response->json(Result::error('RentArea not Deleted'));