myLogger = \Config\Services::mylogger(); $this->employeeModel = new EmployeeModel(); $this->employeePolicyModel = new EmployeePolicyModel(); $this->clientModel = new ClientModel(); $this->clientRMModel = new ClientRMModel(); $this->policesModel = new PolicesModel(); $this->relationshipModel = new RelationshipModel(); $this->fileModel= new FileModel(); $this->clientPolicyModel = new ClientPolicyModel(); $this->policyPremium1Model = new PolicyPremium1Model(); $this->policyPremium2Model = new PolicyPremium2Model(); $this->policyTypeModel = new PolicyTypeModel(); $this->notificationModel = new NotificationModel(); $this->userModel = new UserModel(); $this->feContentModel = new FEContentModel(); $this->addImgModel = new AddImgModel(); $this->ChatBotModel = new ChatBotModel(); } public function getChatResponse() { // try { $request_for = $this->request->getGet('request_for'); $option = $this->request->getGet('option'); $requestData = $this->ChatBotModel->where('request', $request_for) ->where('is_active', 1 ) ->first(); if ($requestData) { if($option != 0){ $decodedData = json_decode($requestData['options'],true); $requestFor = $decodedData[$request_for][$option]; $requestData = $this->ChatBotModel->where('request', $requestFor) ->where('is_active', 1 ) ->first(); } $result = ['request_for'=>$requestData['request'],'options'=>json_decode($requestData['options'],true)]; return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200); } else { return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404); } // } catch (\Throwable $th) { // return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); // } } }