mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
* feat(skin-info): initial page redesign * feat(skin-info): improve page header & colors * feat(skin-info): optimize splash loading * feat(skin-info): add product schema * feat(skin-info): add faq section * feat(champ-info): full page redesign * fix: remove unused splash_color * feat(icon-info): full page redesign * feat(skin-info): convert RP to EUR in skin schema * fix: prevent error on missing element
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Champion;
|
|
use App\Models\ChampionRoles;
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
class ChampionController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
$eightHoursInSeconds = 60 * 60 * 8;
|
|
|
|
$champions = Cache::remember('championsListAllCache', $eightHoursInSeconds, static fn() => Champion::orderBy('name')->get());
|
|
|
|
$roles = Cache::remember('championsRolesCache', $eightHoursInSeconds, static fn() => ChampionRoles::orderBy('champion_name')->get());
|
|
|
|
return view('champions.index', ['champions' => $champions, 'roles' => $roles]);
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(Champion $champion)
|
|
{
|
|
$threeDaysInSeconds = 60 * 60 * 24 * 3;
|
|
|
|
$champion = Cache::remember('championShowCache' . $champion->slug, $threeDaysInSeconds, static fn() => $champion->load('streamers', 'skins', 'lanes'));
|
|
|
|
$streamers = $champion->load('streamers')->streamers;
|
|
|
|
return view('champions.show', ['champion' => $champion, 'streamers' => $streamers]);
|
|
}
|
|
}
|