From 8ff54994a281ce677313c1f3d74e80e3b66996b6 Mon Sep 17 00:00:00 2001 From: Michael Ishola Date: Wed, 14 Jul 2021 15:00:03 +0100 Subject: [PATCH] Added conversation isParticipant property #26 --- src/Http/Controllers/ConversationController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Http/Controllers/ConversationController.php b/src/Http/Controllers/ConversationController.php index 3c6c66e..27fc2f1 100644 --- a/src/Http/Controllers/ConversationController.php +++ b/src/Http/Controllers/ConversationController.php @@ -31,6 +31,7 @@ public function index(PaginableRequest $request) ->whereHasLastMessage($user) ->withCount([ 'messages as latest_message_at' => fn ($q) => $q->select(DB::raw('max(created_at)')), + 'participant as isParticipant' => fn ($q) => $q->whereUserId($user->id), 'unread', ]) ->orderByDesc('latest_message_at')