So I\'m trying to get the number of distinct pids on a query, but the returned value is wrong.
This is what I try to do:
$ad->getcodes()->group
You can use the following way to get the unique data as per your need as follows,
$data = $ad->getcodes()->get()->unique('email'); $count = $data->count();
Hope this will work.