$id = $request->param('id'); $data = $request->param('investorData'); $contactsData = $request->param('investorContacts'); $assetsData = $request->param('investorAssets'); $result = Investors::updateInvestor($id, $data, $contactsData, $assetsData); if ($result > 0) { $response->json(Result::success('Investor Updated.')); } elseif ($result === 0) { $response->json(Result::success('Investor not Updated.')); } else { $response->json(Result::error('Investor not found')); } }); $this->respond(['GET', 'POST'], '/delete/[:id]', function ($request, $response, $service, $app) { $id = $request->param('id'); $investorResult = Investors::deleteInvestor($id); InvestmentProfiles::deleteInvestorProfiles($id); Notes::deleteInvestorNotes($id); Assets::deleteInvestorAssets($id); Logs::deleteInvestorLogs($id); Contacts::deleteInvestorContacts($id); if ($investorResult > 0) { $response->json(Result::success('Investor Deleted.')); } else { $response->json(Result::error('Investor not Deleted')); } }); $this->respond(['GET', 'POST'], '/get/[i:id]', function ($request, $response, $service, $app) { $id = $request->param('id'); $investorData = Investors::getInvestor($id); $investorContacts = Contacts::getInvestorContacts($id);