From b425eeabc02245c30a04e76259875ba4d5c4aee8 Mon Sep 17 00:00:00 2001 From: Sergey Panarin Date: Sat, 24 Aug 2024 13:01:07 +0200 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Chat.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Models/Chat.php b/app/Models/Chat.php index 7d6a0dd..51b843b 100644 --- a/app/Models/Chat.php +++ b/app/Models/Chat.php @@ -69,7 +69,11 @@ class Chat extends Model ->with('employer') ->with('last_message') ->withCount(['unread_messages' => function ($query) use($user_id) { - $query->where('to_user_id', '=', $user_id)->where('flag_new', '=', 1); + $query + ->where('to_user_id', '=', $user_id) + ->whereNotNull('chat_id_from') + ->where('flag_new', '=', 1) + ; }]) ->where('user_id', '=', $user_id) ->where('is_removed', '=', 0) -- 1.7.10.4