Commit fd2519b604a8621ec60e829d26c01dc7fb63525c

Authored by Андрей Ларионов
Exists in master

Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su

Showing 1 changed file Side-by-side Diff

... ... @@ -69,7 +69,11 @@ class Chat extends Model
69 69 ->with('employer')
70 70 ->with('last_message')
71 71 ->withCount(['unread_messages' => function ($query) use($user_id) {
72   - $query->where('to_user_id', '=', $user_id)->where('flag_new', '=', 1);
  72 + $query
  73 + ->where('to_user_id', '=', $user_id)
  74 + ->whereNotNull('chat_id_from')
  75 + ->where('flag_new', '=', 1)
  76 + ;
73 77 }])
74 78 ->where('user_id', '=', $user_id)
75 79 ->where('is_removed', '=', 0)