mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 18:20:48 +01:00
feat(controller): add HTMLSitemapController for generating HTML sitemap
- Added HTMLSitemapController to generate sitemap with cached data - Updated footer.blade.php and index.blade.php for sitemap links
This commit is contained in:
27
app/Http/Controllers/HTMLSitemapController.php
Normal file
27
app/Http/Controllers/HTMLSitemapController.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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', compact('champions', 'skins', 'icons', 'posts'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user