title('新生总报道率'); } /** * 处理请求. * * @param Request $request * * @return void */ public function handle(Request $request) { //取出当前年份 $config = Config::query()->where([ "unique_identification" => "annual_session" ])->first(); //当前年份已完成二级学院扫码的学生 $allCount = CompletedOfflineStep::query()->where([ "annual_session" => $config->data, ])->select("unique_number")->distinct()->get(); $number = count($allCount); //取出当前年份录入的学生 $studentsList = AdmissionNewStudents::query()->where([ "annual_session" => $config->data, "status" => AdmissionNewStudents::STATUS_YES ])->select("idCard")->distinct()->get(); $studentsNum = count($studentsList); $this->content((($number / $studentsNum) * 100)."%"); } /** * @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); } }