Last active
March 8, 2021 05:16
-
-
Save EDDYMENS/d56a161ccbb0d5740e201770caec4631 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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