AppComment::whereIn('id', [1, 2, 3])->with(['posts' => function($q) { $q->where('category', 3); }])->get();