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)