diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index d2f21d4..f7ed779 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -346,7 +346,11 @@ class SystemController extends Controller ->join('echomail_seenby',['echomail_seenby.echomail_id'=>'echomails.id']) ->whereIn('address_id',[$request->src]) ->distinct() - ->with(['seenby:id']) + ->with(['seenby'=>function($query) use ($request) { + return $query + ->select('id') + ->whereIn('address_id',[$request->src,$request->dst]); + }]) ->get() ->filter(function($item) use ($request) { return $item->seenby->contains($request->dst) && $item->seenby->contains($request->src);