laravel count distinct

$result->count(DB::raw("distinct(material_id)"));

原文地址:https://www.cnblogs.com/zouzhe0/p/6305468.html