Laravel-admin 实现一个分组求和的数据展现

Laravel-admin 实现一个分组求和的数据展现

file

file

protected function totalGrid()
{
$grid = new Grid(new MerchantStatistic);
$grid->model()->groupBy('merchant_id')->select([DB::raw("sum(count) as total"),'merchant_id']);
$grid->merchant_id('商户名')->display(function ($value) {
return $this->merchant->name ;
});

return $grid;
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注