title('Product Orders'); $this->chartLabels(['Finished', 'Pending', 'Rejected']); $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(23043, 14658, 4758); // 图表数据 $this->withChart([70, 52, 26]); // 总数 $this->chartTotal('Total', 344); } } /** * 设置图表数据. * * @param array $data * * @return $this */ public function withChart(array $data) { return $this->chart([ 'series' => $data, ]); } /** * 卡片内容. * * @param int $finished * @param int $pending * @param int $rejected * * @return $this */ public function withContent($finished, $pending, $rejected) { return $this->content( <<
Finished
{$finished}
Pending
{$pending}
Rejected
{$rejected}
HTML ); } }