}); $this->respond(['GET', 'POST'], '/get/[i:id]', function ($request, $response, $service, $app) { $id = $request->param('id'); $profileData = InvestmentProfiles::getInvestmentProfile($id); $investor = Investors::getInvestorFromProfile($id); $result = array("profileData" => $profileData, "investor" => $investor); if ($profileData) { $response->json(Result::success('', $result)); } else { $response->json(Result::error('InvestmentProfile not found')); } }); $this->respond(['GET', 'POST'], '/edit/[:id]', function ($request, $response, $service, $app) { $id = $request->param('id'); $data = json_decode($request->body(), true); $result = InvestmentProfiles::updateInvestmentProfile($id, $data); if ($result > 0) { $response->json(Result::success('InvestmentProfile Updated.')); } elseif ($result === 0) { $response->json(Result::success('InvestmentProfile not Updated.')); } else { $response->json(Result::error('InvestmentProfile not found')); } }); $this->respond(['GET', 'POST'], '/delete/[:id]', function ($request, $response, $service, $app) { $id = $request->param('id'); $result = InvestmentProfiles::deleteInvestmentProfile($id); if ($result > 0) { $response->json(Result::success('InvestmentProfile Deleted.')); } else { $response->json(Result::error('InvestmentProfile not Deleted'));