use AppModelsUser; $users = User::withWhereHas('posts', function ($query) { $query->where('featured', true); })->get();