Files
HeimerdingerLoL/app/Http/Controllers/HTMLSitemapController.php
Rico van Zelst 20f08944c2 feat: Add Heimerdinger PHP CS rules for Laravel
- Added a new phpcs.xml.dist file with specific coding standards for Laravel development.
2024-06-18 13:09:26 +02:00

30 lines
966 B
PHP

<?php
namespace App\Http\Controllers;
use App\Models\Champion;
use App\Models\ChampionSkin;
use App\Models\SummonerIcon;
use Illuminate\Support\Facades\Cache;
use Spatie\Sheets\Facades\Sheets;
class HTMLSitemapController extends Controller
{
public function index()
{
$twentyHoursInSeconds = 60 * 60 * 20;
$champions = Cache::remember('sitemap_championsCache', $twentyHoursInSeconds, fn () => Champion::orderBy('name')->get());
$skins = Cache::remember('sitemap_championSkinsCache', $twentyHoursInSeconds, fn () => ChampionSkin::orderBy('skin_name')->get());
$icons = Cache::remember('sitemap_iconsCache', $twentyHoursInSeconds, fn () => SummonerIcon::orderBy('title')->get());
$posts = Sheets::all()->sortByDesc('date');
return view('sitemap.index', [
'champions' => $champions,
'skins' => $skins,
'icons' => $icons,
'posts' => $posts,
]);
}
}