Update
This commit is contained in:
@@ -111,42 +111,47 @@ class RequestLogController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$requestLogControllerInstance = new PrimeCenterRequestLog();
|
$requestLogControllerInstance = new PrimeCenterRequestLog();
|
||||||
$response = $requestLogControllerInstance->createNew($request);
|
try {
|
||||||
|
$response = $requestLogControllerInstance->createNew($request);
|
||||||
|
|
||||||
if($response->original['statusCode'] == 200)
|
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)
|
|
||||||
{
|
{
|
||||||
//send to alarm
|
//send email
|
||||||
$nameTo = 'Admin LinkSehat';
|
// Insert data notifications
|
||||||
$dataEmail = [
|
$emailTo = 'alarm.center@linksehat.com';
|
||||||
|
$dataNotif = [
|
||||||
'email' => $emailTo,
|
'email' => $emailTo,
|
||||||
'name' => $nameTo,
|
'title' => 'Request LOG',
|
||||||
'subject' => 'Request LOG from Hospital Portal'. ' '.date('Y-m-d H:i:s'),
|
'description' => 'Request LOG from Hospital Portal',
|
||||||
'body' => View::make('email/notif_email', ['name' => $nameTo, 'link' => 'https://primecenter.linksehat.com/'])->render(),
|
'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
|
||||||
}
|
{
|
||||||
else
|
return ApiResponse::apiResponse('Server Error', $data, trans('Message.server_error'), 500);
|
||||||
{
|
}
|
||||||
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) {
|
} catch (\Exception $e) {
|
||||||
// Rollback transaksi jika terjadi kesalahan
|
// Rollback transaksi jika terjadi kesalahan
|
||||||
|
|||||||
Reference in New Issue
Block a user