db->table('employee_polices') ->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables ->join('client_policy', 'client_policy.id = employee_polices.client_policy_id') ->join('policies', 'policies.id = client_policy.policy_id') ->where('employee_polices.employee_id', $id) ->get() ->getResult(); } // for EMP rest API process do not change public function checkExistingEmpEntrollment($arr) { return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->first(); } }