diff --git a/site/app/Http/Controllers/PageController.php b/site/app/Http/Controllers/PageController.php index e0a4aa0..c29624d 100644 --- a/site/app/Http/Controllers/PageController.php +++ b/site/app/Http/Controllers/PageController.php @@ -100,8 +100,9 @@ private function numberFormatPrecision($number, $precision = 2, $separator = '.' } private function leaderboardTwelveMonths() { - $endDate = now()->endOfDay()->subYear()->format('Y-m-d'); - $leaderboard = DB::table('episodes') + $leaderboard = cache()->remember('leaderboardTwelveMonths', 30, function() { + $endDate = now()->endOfDay()->subYear()->format('Y-m-d'); + $leaderboard = DB::table('episodes') ->join('artworks', 'artworks.id', '=', 'episodes.artwork_id') ->join('artists', 'artists.id', '=', 'artworks.artist_id') ->select([ @@ -115,7 +116,9 @@ private function leaderboardTwelveMonths() { ->orderByDesc('artworkCount') ->limit(10) ->get(); - $leaderboard = $this->addArtistModelToLeaderboard($leaderboard); + $leaderboard = $this->addArtistModelToLeaderboard($leaderboard); + return $leaderboard; + }); return $leaderboard; }