$result->count(\DB::raw("distinct(material_id)")); 转载于:https://www.cnblogs.com/zouzhe0/p/6305468.html