title('Tickets'); $this->height(400); $this->chartHeight(300); $this->chartLabels('Completed Tickets'); $this->dropdown([ '7' => 'Last 7 Days', '28' => 'Last 28 Days', '30' => 'Last Month', '365' => 'Last Year', ]); } /** * 处理请求 * * @param Request $request * * @return mixed|void */ public function handle(Request $request) { switch ($request->get('option')) { case '365': case '30': case '28': case '7': default: // 卡片内容 $this->withContent(162); // 卡片底部 $this->withFooter(29, 63, '1d'); // 图表数据 $this->withChart(83); } } /** * 设置图表数据. * * @param int $data * * @return $this */ public function withChart(int $data) { return $this->chart([ 'series' => [$data], ]); } /** * 卡片内容 * * @param string $content * * @return $this */ public function withContent($content) { return $this->content( <<

{$content}

Tickets HTML ); } /** * 卡片底部内容. * * @param string $new * @param string $open * @param string $response * * @return $this */ public function withFooter($new, $open, $response) { return $this->footer( <<

New Tickets

{$new}

Open Tickets

{$open}

Response Time

{$response}
HTML ); } }