GWM : add dependent api
This commit is contained in:
parent
e75c769801
commit
4479e94e41
@ -230,19 +230,23 @@ class EmployeeRestController extends AdminController
|
||||
try {
|
||||
$data = $this->request->getJSON();
|
||||
|
||||
// dd($data);
|
||||
//enrolment check
|
||||
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id);
|
||||
if($openForEnrollment == false){
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [],'message' => 'Enrollment closed.'], 404);
|
||||
}
|
||||
|
||||
//dependent duplicate check
|
||||
if ( ! isset($data[0]->id) ) {
|
||||
$validationFailed = $this->employeeHelper->validation_addEmployeeAndDependence($data);
|
||||
|
||||
if($validationFailed){
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "validation_addEmployeeAndDependence failed ..!!"], 404);
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [],'message' => "Relation already exists."], 404);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id);
|
||||
if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); }
|
||||
|
||||
|
||||
if ($data) {
|
||||
|
||||
@ -291,14 +295,14 @@ class EmployeeRestController extends AdminController
|
||||
$this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code , $data[0]->client_branch_id);
|
||||
|
||||
$result = [];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result,'message' => "Successfully updated."], 200);
|
||||
} else {
|
||||
$result = "No Matches";
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result,'message' => "Action failed."], 404);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage(),'message' => "Action failed."], 500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user