32 lines
811 B
PHP
32 lines
811 B
PHP
<?php
|
|
|
|
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
|
|
{
|
|
public function index()
|
|
{
|
|
if (App::environment('production') && env('COMING_SOON_ENABLED', true)) {
|
|
return Inertia::render('comingsoon');
|
|
}
|
|
|
|
// 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', [
|
|
'stats' => $stats,
|
|
]);
|
|
}
|
|
}
|