header('核销总数据') ->description('description') ->body($this->grid()); } /** * 今日核销数据 * @param Content $content [description] * @return [type] [description] */ public function today(Content $content) { $this->today = true; return $content ->header('核销今日数据') ->description('description') ->body($this->grid()); } protected function grid() { $grid = new Grid(new User); $grid->model()->whereHas('identity', function ($q) { $q->where('identity_id', 1); })->where('type', 'pingan'); $grid->disableCreateButton(); $grid->disableBatchActions(); $grid->disableActions(); $grid->filter(function ($filter) { $filter->column(1 / 2, function ($filter) { $filter->where(function ($query) { $query->whereHas('info', function ($query) { $query->where('nickname', 'like', "%{$this->input}%"); }); }, '渠道名称'); }); }); $grid->column('渠道')->display(function () { return $this->info->nickname; }); $today = $this->today; $grid->column('100元减10元优惠券')->display(function () use ($today) { return $this->getCouponCount('YSD-full100-10', $today); }); $grid->column('100元减25元优惠券')->display(function () use ($today) { return $this->getCouponCount('YSD-full100-25', $today); }); $grid->column('100元减50元优惠券')->display(function () use ($today) { return $this->getCouponCount('YSD-full100-50', $today); }); $grid->column(' 200元减100元优惠券')->display(function () use ($today) { return $this->getCouponCount('YSD-full200-100', $today); }); return $grid; } }