Update
This commit is contained in:
@@ -111,42 +111,47 @@ class RequestLogController extends Controller
|
||||
}
|
||||
|
||||
$requestLogControllerInstance = new PrimeCenterRequestLog();
|
||||
$response = $requestLogControllerInstance->createNew($request);
|
||||
|
||||
if($response->original['statusCode'] == 200)
|
||||
{
|
||||
//send email
|
||||
// Insert data notifications
|
||||
$emailTo = 'alarm.center@linksehat.com';
|
||||
$dataNotif = [
|
||||
'email' => $emailTo,
|
||||
'title' => 'Request LOG',
|
||||
'description' => 'Request LOG from Hospital Portal',
|
||||
'type' => 1,
|
||||
'isUnRead' => true,
|
||||
'created_by' => auth()->user()->id,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
$sendNotif = Helper::insertNotification($dataNotif);
|
||||
// Send Email after insert notifications
|
||||
if($sendNotif)
|
||||
try {
|
||||
$response = $requestLogControllerInstance->createNew($request);
|
||||
|
||||
if($response->original['statusCode'] == 200)
|
||||
{
|
||||
//send to alarm
|
||||
$nameTo = 'Admin LinkSehat';
|
||||
$dataEmail = [
|
||||
//send email
|
||||
// Insert data notifications
|
||||
$emailTo = 'alarm.center@linksehat.com';
|
||||
$dataNotif = [
|
||||
'email' => $emailTo,
|
||||
'name' => $nameTo,
|
||||
'subject' => 'Request LOG from Hospital Portal'. ' '.date('Y-m-d H:i:s'),
|
||||
'body' => View::make('email/notif_email', ['name' => $nameTo, 'link' => 'https://primecenter.linksehat.com/'])->render(),
|
||||
'title' => 'Request LOG',
|
||||
'description' => 'Request LOG from Hospital Portal',
|
||||
'type' => 1,
|
||||
'isUnRead' => true,
|
||||
'created_by' => auth()->user()->id,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
Helper::sendEmail($dataEmail);
|
||||
$sendNotif = Helper::insertNotification($dataNotif);
|
||||
// Send Email after insert notifications
|
||||
if($sendNotif)
|
||||
{
|
||||
//send to alarm
|
||||
$nameTo = 'Admin LinkSehat';
|
||||
$dataEmail = [
|
||||
'email' => $emailTo,
|
||||
'name' => $nameTo,
|
||||
'subject' => 'Request LOG from Hospital Portal'. ' '.date('Y-m-d H:i:s'),
|
||||
'body' => View::make('email/notif_email', ['name' => $nameTo, 'link' => 'https://primecenter.linksehat.com/'])->render(),
|
||||
];
|
||||
Helper::sendEmail($dataEmail);
|
||||
}
|
||||
return ApiResponse::apiResponse("Success", $data, trans('Message.success'), 200);
|
||||
}
|
||||
return ApiResponse::apiResponse("Success", $data, trans('Message.success'), 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ApiResponse::apiResponse('Server Error', $data, trans('Message.server_error'), 500);
|
||||
else
|
||||
{
|
||||
return ApiResponse::apiResponse('Server Error', $data, trans('Message.server_error'), 500);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// Tangani kesalahan di sini
|
||||
return ApiResponse::apiResponse('Server Error', $data, $e->getMessage(), 500);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// Rollback transaksi jika terjadi kesalahan
|
||||
|
||||
Reference in New Issue
Block a user