Mysql distinct未从laravel elequent中删除重复项

Mysql distinct未从laravel elequent中删除重复项,mysql,laravel,Mysql,Laravel,我正在尝试从laravel elequent查询结果中删除重复项,如下所示: $helping_hand = Model::where('user_id','2')->where('amount','>',0)->get(); 现在这个模型返回8个结果,在模型中有相同的注释id,但是对于每个注释id,我希望它在结果中出现一次,所以当我添加 $helping_hand = Model::where('user_id','2')->distinct('c

我正在尝试从laravel elequent查询结果中删除重复项,如下所示:

        
$helping_hand = Model::where('user_id','2')->where('amount','>',0)->get();

现在这个模型返回8个结果,在模型中有相同的注释id,但是对于每个注释id,我希望它在结果中出现一次,所以当我添加

$helping_hand = Model::where('user_id','2')->distinct('comment_id')->where('amount','>',0)->get();

它不会从结果中删除重复项。因为我不想使用分组方式,所以有没有什么方法可以使用distinct。提前感谢

在收藏中尝试此功能
$q=$help\u hand->unique('comment\u id')
Small Point Distinct没有参数,就像在原始查询中一样,Distinct应用于查询,而不仅仅是一列