Update
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\BackgroundMedia;
|
||||
use App\Models\MemeMedia;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class FrontHomeController extends Controller
|
||||
@@ -13,6 +16,16 @@ public function index()
|
||||
return Inertia::render('comingsoon');
|
||||
}
|
||||
|
||||
return Inertia::render('home/home');
|
||||
// Cache the counts for 1 day to reduce server calls
|
||||
$stats = Cache::remember('home_stats', 60 * 60 * 24, function () {
|
||||
return [
|
||||
'meme_count' => MemeMedia::count(),
|
||||
'background_count' => BackgroundMedia::count(),
|
||||
];
|
||||
});
|
||||
|
||||
return Inertia::render('home/home', [
|
||||
'stats' => $stats,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user