kirim notification

This commit is contained in:
2024-06-10 10:05:33 +07:00
parent 03d94905fa
commit 8474c59834

View File

@@ -209,8 +209,8 @@ class ChatDoctorController extends Controller
if ($user->nIDUser) { // Jika Dependent yang request
$user = UserLMS::where('nIDUser',$livechat->patient_id)->first();
}
$user->notify(new SendNotification($title, $body, $dataNotif));
return ApiResponse::apiResponse("Success",['message' => 'Livechat updated successfully'], trans('Message.success'), 200);
$user->notify(new SendNotification($title, $body, $dataNotif));
return ApiResponse::apiResponse("Success",['message' => 'Livechat updated successfully'], trans('Message.success'), 200);
} else {
return Helper::responseJson(
status: 'Not Found',
@@ -328,8 +328,25 @@ class ChatDoctorController extends Controller
'type' => 'summary'
]);
// Send Pusher
ChatMessageSent::dispatch($message);
$title = 'Decline Livechat';
$body = 'Decline Livechat';
$dataNotif = [
'channel_id' => (string) $channel->id,
'livechat_id' => (string) $livechat->id,
'type' => 'summary-chat'
];
$user = UserLMS::where('nID',$livechat->patient_id)->first();
if ($user) {
if ($user->nIDUser) { // Jika Dependent yang request
$user = UserLMS::where('nIDUser',$livechat->patient_id)->first();
}
$user->notify(new SendNotification($title, $body, $dataNotif));
return ApiResponse::apiResponse("Success",['message' => 'Livechat updated successfully'], trans('Message.success'), 200);
}
return ApiResponse::apiResponse("Success",['message' => 'Livechat updated successfully'], trans('Message.success'), 200);
} else {
return response()->json(['message' => 'Livechat not found'], 404);