title('线上报到人数'); //取出线上步骤 $stepList = Step::query()->pluck("title", "id"); $downList = []; foreach($stepList as $key => $item){ $downList[$key] = $item; } $this->dropdown($downList); } /** * 处理请求. * * @param Request $request * * @return void */ public function handle(Request $request) { $stepId = $request->get('option'); //取出当前年份 $config = Config::query()->where([ "unique_identification" => "annual_session" ])->first(); $where = [ "annual_session" => $config->data, ]; if(!empty($stepId)){ $where["step_id"] = $stepId; } //缴费总人数 $allCount = CompletedStep::query() ->where($where)->distinct("unique_number")->count(); $this->content($allCount); if($allCount > 0){ $this->up($allCount); }else{ $this->down($allCount); } } /** * @param int $percent * * @return $this */ public function up($percent) { return $this->footer( " {$percent}人 为当前年份线上报到人数" ); } /** * @param int $percent * * @return $this */ public function down($percent) { return $this->footer( " {$percent}人 为当前年份线上报到人数" ); } /** * 设置卡片底部内容. * * @param string|Renderable|\Closure $footer * * @return $this */ public function footer($footer) { $this->footer = $footer; return $this; } /** * 渲染卡片内容. * * @return string */ public function renderContent() { $content = parent::renderContent(); return <<

{$content}

{$this->renderFooter()}
HTML; } /** * 渲染卡片底部内容. * * @return string */ public function renderFooter() { return $this->toString($this->footer); } }