当统计一个有重复的字段可以用这个方法

$count = $model->where($map)->count('distinct(id)');

原文地址:https://www.cnblogs.com/caicaizi/p/7199559.html