Distinct in eloquent, laravel


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();









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

JMeter fails on beanshell imports

Why in node-red my HTTP POST no receive payload from inject?

PHP contact form sending but not receiving emails