CHANGES-in-restApi:GWM
This commit is contained in:
parent
62eec1f44c
commit
f99c0ca5e2
@ -213,7 +213,7 @@ $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfi
|
||||
|
||||
|
||||
|
||||
|
||||
$routes->get("getClientPolicy", "EmployeeRestController::getClientPolicy");
|
||||
|
||||
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
|
||||
|
||||
@ -211,29 +211,28 @@ class EmployeeRestController extends AdminController
|
||||
public function getEmployeeAndDependenceByClientId()
|
||||
{
|
||||
try {
|
||||
$empData = $this->employeeModel
|
||||
->where('client_id', $this->request->getGet('client_id'))
|
||||
->where('relationship', 'self')
|
||||
->orderBy('id')
|
||||
->findAll();
|
||||
|
||||
$empData = $this->employeeModel->where('client_id', $this->request->getGet('client_id'))
|
||||
->where('relationship !=', null)
|
||||
->orderBy('emp_code')->orderBy('id')->findAll();
|
||||
|
||||
$result = [];
|
||||
// $result = [];
|
||||
|
||||
foreach ($empData as $employee) {
|
||||
$employeeDependence = $this->employeeModel
|
||||
->where('emp_code', $employee['emp_code'])
|
||||
->where('relationship !=', 'self')
|
||||
->findAll();
|
||||
// foreach ($empData as $employee) {
|
||||
// $employeeDependence = $this->employeeModel
|
||||
// ->where('emp_code', $employee['emp_code'])
|
||||
// ->where('relationship !=', 'self')
|
||||
// ->findAll();
|
||||
|
||||
// Use object notation to access properties and set 'dependence'
|
||||
$employee['dependence'] = $employeeDependence ?: [];
|
||||
// // Use object notation to access properties and set 'dependence'
|
||||
// $employee['dependence'] = $employeeDependence ?: [];
|
||||
|
||||
$result[] = $employee;
|
||||
}
|
||||
// $result[] = $employee;
|
||||
// }
|
||||
|
||||
// You probably meant to check $result, not $data
|
||||
if ($result) {
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||
if ($empData) {
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
||||
}
|
||||
@ -248,7 +247,7 @@ class EmployeeRestController extends AdminController
|
||||
public function getClientPolicy()
|
||||
{
|
||||
try {
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id,, policies.id as policy_id, policies.name as policy_name')
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id,policies.policy_type_id as policy_type_id, policies.name as policy_name')
|
||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->findAll();
|
||||
|
||||
@ -176,7 +176,7 @@ class RestAuthenticationController extends AdminController
|
||||
->where('level_contacts.mobile', $mobile_number )
|
||||
->find();
|
||||
|
||||
$result = JWTToken::encode($hrData);
|
||||
$result = JWTToken::encode($hrData['0']);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "No data"],404);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user