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
This was working for me so Try This: $ad->getcodes()->distinct('pid')->count()