/** * @return mixed */ public static function launchesPerYear() { return Cache::remember('stats:launchesPerYear', 60, function () { return ['values' => Mission::select(DB::raw('COUNT(mission_id) AS launches, YEAR(launch_exact) AS year'))->where('status', 'Complete')->groupBy('year')->get()->toArray(), 'extrapolation' => false, 'xAxis' => ['type' => 'ordinal', 'key' => 'year', 'title' => 'Year'], 'yAxis' => ['type' => 'linear', 'key' => 'launches', 'title' => 'Launches', 'zeroing' => true]]; }); }