Distinct in eloquent, laravel

I have a query which works according to my expectations, it returns users but the data is repeating and distinct is not working for some reason, would appreciate if someone could help me. thanks here is the query.

  User::has('partner_groups')
        ->whereHas('partner_groups', function ($query) use ($id) {
            $query->where('id', $id)->where('user_id', '!=', Auth::id());
        })->get();