Skip to content

Instantly share code, notes, and snippets.

@EDDYMENS
Last active March 8, 2021 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EDDYMENS/d56a161ccbb0d5740e201770caec4631 to your computer and use it in GitHub Desktop.
Save EDDYMENS/d56a161ccbb0d5740e201770caec4631 to your computer and use it in GitHub Desktop.
class StatisticsController extends Controller {
public function dashboard(Request $request, $year) {
$year = $year ?? Carbon::now()->year;
if(!Cache::has('dashStatsCache-'.$year)) {
Artisan::call('logStats:run', [
'year' => $year,
]);
}
$stats = Cache::get('dashStatsCache-'.$year);
return view('dashboard')->with(compact('stats'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment