diff --git a/app/Models/Chat.php b/app/Models/Chat.php index 329156c..8173580 100644 --- a/app/Models/Chat.php +++ b/app/Models/Chat.php @@ -65,10 +65,7 @@ class Chat extends Model public static function get_user_chats(int $user_id){ return Chat::query() - ->with('user') - ->with('worker') - ->with('employer') - ->with('last_message') + ->with(['user', 'worker', 'employer', 'last_message']) ->withCount(['unread_messages' => function ($query) use($user_id) { $query ->where('to_user_id', '=', $user_id) @@ -76,6 +73,7 @@ class Chat extends Model ->where('flag_new', '=', 1) ; }]) + ->whereHas('user') ->where('user_id', '=', $user_id) ->where('is_removed', '=', 0) ->orderByDesc('is_fixed') diff --git a/resources/views/employers/cabinet.blade.php b/resources/views/employers/cabinet.blade.php index ecd11a6..b26a298 100644 --- a/resources/views/employers/cabinet.blade.php +++ b/resources/views/employers/cabinet.blade.php @@ -71,7 +71,7 @@