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