diff --git a/Modules/Linksehat/Http/Controllers/Api/Doctor/ChatDoctorController.php b/Modules/Linksehat/Http/Controllers/Api/Doctor/ChatDoctorController.php index f994f741..6d8a698b 100644 --- a/Modules/Linksehat/Http/Controllers/Api/Doctor/ChatDoctorController.php +++ b/Modules/Linksehat/Http/Controllers/Api/Doctor/ChatDoctorController.php @@ -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);