Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
97a6cd6512
@ -2519,7 +2519,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
public function storeFireBase()
|
||||
{
|
||||
// try {
|
||||
try {
|
||||
$json = $this->request->getJSON();
|
||||
$firebase_token = $json->firebase_token;
|
||||
$mobile = $json->mobile;
|
||||
@ -2565,39 +2565,39 @@ class EmployeeRestController extends AdminController
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => 'Employee not found'], 404);
|
||||
}
|
||||
// } catch (\Throwable $th) {
|
||||
// log_message('error', 'An error occurred: ' . $th->getMessage());
|
||||
// return $this->respond(['status' => 'failed', 'code' => 500, 'message' => 'An error occurred', 'error' => $th->getMessage()], 500);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function sendPushNotification()
|
||||
{
|
||||
$deviceToken = 'cMVKESh8QzqIl8nh_yqbcl:APA91bHKm87Sh1goVJNKZtctV4etgLMQboI0eyDVn3MH1yf9cO-2RtQRlFnKLdataOxosoxm7a4JvATKjfI1_Bids46mGw5m8zesp90mR4odCbD_cJtGmBeMYt4hssSY0YtAht1emK_H';
|
||||
$title = 'Nhance';
|
||||
$body = 'All your policy enrolled successfully ..!';
|
||||
|
||||
// Initialize Firebase with the service account
|
||||
$firebase = (new Factory)
|
||||
->withServiceAccount(APPPATH . 'Config/google-services.json')
|
||||
->createMessaging();
|
||||
|
||||
$notification = Notification::create($title, $body);
|
||||
$message = CloudMessage::withTarget('token', $deviceToken)
|
||||
->withNotification($notification);
|
||||
|
||||
try {
|
||||
$firebase->send($message);
|
||||
return $this->response->setJSON(['status' => 'success']);
|
||||
} catch (MessagingException $e) {
|
||||
//return $this->response->setJSON(['status' => 'error', 'message' => $e->getMessage()]);
|
||||
log_message('error', $e->getMessage());
|
||||
} catch (\Throwable $th) {
|
||||
log_message('error', 'An error occurred: ' . $th->getMessage());
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'message' => 'An error occurred', 'error' => $th->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// public function sendPushNotification()
|
||||
// {
|
||||
// $deviceToken = 'cMVKESh8QzqIl8nh_yqbcl:APA91bHKm87Sh1goVJNKZtctV4etgLMQboI0eyDVn3MH1yf9cO-2RtQRlFnKLdataOxosoxm7a4JvATKjfI1_Bids46mGw5m8zesp90mR4odCbD_cJtGmBeMYt4hssSY0YtAht1emK_H';
|
||||
// $title = 'Nhance';
|
||||
// $body = 'All your policy enrolled successfully ..!';
|
||||
|
||||
// // Initialize Firebase with the service account
|
||||
// $firebase = (new Factory)
|
||||
// ->withServiceAccount(APPPATH . 'Config/google-services.json')
|
||||
// ->createMessaging();
|
||||
|
||||
// $notification = Notification::create($title, $body);
|
||||
// $message = CloudMessage::withTarget('token', $deviceToken)
|
||||
// ->withNotification($notification);
|
||||
|
||||
// try {
|
||||
// $firebase->send($message);
|
||||
// return $this->response->setJSON(['status' => 'success']);
|
||||
// } catch (MessagingException $e) {
|
||||
// //return $this->response->setJSON(['status' => 'error', 'message' => $e->getMessage()]);
|
||||
// log_message('error', $e->getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
@ -73,7 +73,9 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)
|
||||
->where('relationship', 'self')
|
||||
->where('is_active', 1)->first();
|
||||
->where('emp_status !=', 'truncated')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
if ($employeeData) {
|
||||
|
||||
@ -137,7 +139,8 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
$HrData = $this->hrModel->where('mobile', $mobile_number)
|
||||
->where('contact_type', 'client')
|
||||
->where('is_active', 1)->first();
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
if ($HrData) {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user