diff --git a/app/Controllers/Employers.php b/app/Controllers/Employers.php index f0d3cc2..6a10b94 100644 --- a/app/Controllers/Employers.php +++ b/app/Controllers/Employers.php @@ -2,11 +2,53 @@ namespace App\Controllers; -class Employers +class Employers extends BaseController { - public function verifyEmployer(){ - return []; - } + public function verifyEmployer() + { + $data = $this->request->getPost(); + if ($data['employer_uid'] != '') { + + $checkData = $this->APIcall("POST", "http://10.10.10.48:6332/api/verify/employer", json_encode($data)); + + + $udata = [ + 'employer_uid' => $data['employer_uid'] + ]; + $addedData = $this->insert_db('employer_checks',$udata); + + if( $addedData["uid"] ==''){ + $response = [ + 'message' => 'Failure', + 'call_return' => '100', + 'token' => '', + 'verify_data' => $checkData + ]; + return $this->fail($response, 500); + } + + $response = [ + 'message' => 'Verification text sent to employer', + 'call_return' => '100', + 'verification_id' => $addedData["uid"], + 'status' => $checkData["res"]["status"], + 'verify_data' => $checkData["res"]["data"] + ]; + + return $this->respond($response, 200); + } else { + $response = [ + 'message' => 'Failure', + 'call_return' => '100', + 'token' => '' + ]; + return $this->fail($response, 409); + } + + + //return json_encode( $response ); + + } } \ No newline at end of file