title(trans('admin-home.Recent_events')); $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) { $games = Game::query()->orderByDesc('id')->limit(5)->select(['id','name','begin_time'])->get()->toArray(); $this->withContent($games); } /** * 设置图表数据. * * @param int $data * * @return $this */ public function withChart(int $data) { return $this->chart([ 'series' => [$data], ]); } /** * 卡片内容 * * @param string $content * * @return $this */ public function withContent($content) { $str = ''; foreach ($content as $k=>$v){ $str.= '
New Tickets
{$new}Open Tickets
{$open}Response Time
{$response}