Merge remote-tracking branch 'origin/analysis-djNGnL'

This commit is contained in:
Rico van Zelst
2024-03-31 21:01:01 +02:00
3 changed files with 7 additions and 7 deletions

View File

@@ -13,7 +13,7 @@ function getRoleIcon($roleName): string
'Support' => 'gm-support.png', 'Support' => 'gm-support.png',
]; ];
return asset('img/' . $roleIcons[$roleName]); return asset('img/'.$roleIcons[$roleName]);
} }
function getAverageColorFromImageUrl($imageUrl): string function getAverageColorFromImageUrl($imageUrl): string

View File

@@ -30,14 +30,14 @@ class ChampionController extends Controller
$threeDaysInSeconds = 60 * 60 * 24 * 3; $threeDaysInSeconds = 60 * 60 * 24 * 3;
$sixMonthsInSeconds = 60 * 60 * 24 * 30 * 6; $sixMonthsInSeconds = 60 * 60 * 24 * 30 * 6;
$champion = Cache::remember('championShowCache' . $champion->slug, $threeDaysInSeconds, static fn () => $champion->load('streamers', 'skins', 'lanes')); $champion = Cache::remember('championShowCache'.$champion->slug, $threeDaysInSeconds, static fn () => $champion->load('streamers', 'skins', 'lanes'));
$streamers = $champion->load('streamers')->streamers; $streamers = $champion->load('streamers')->streamers;
$splashColor = Cache::remember( $splashColor = Cache::remember(
'championSplashColorCache' . $champion->slug, 'championSplashColorCache'.$champion->slug,
$sixMonthsInSeconds, $sixMonthsInSeconds,
static fn () => getAverageColorFromImageUrl('https://wsrv.nl/?url=' . $champion->getChampionImageAttribute()) static fn () => getAverageColorFromImageUrl('https://wsrv.nl/?url='.$champion->getChampionImageAttribute())
); );
$champion->splash_color = $splashColor; $champion->splash_color = $splashColor;

View File

@@ -55,15 +55,15 @@ class ChampionSkinController extends Controller
public function show(ChampionSkin $championSkin) public function show(ChampionSkin $championSkin)
{ {
$skin = Cache::remember( $skin = Cache::remember(
'championSkinShowCache' . $championSkin->slug, 'championSkinShowCache'.$championSkin->slug,
60 * 60 * 48, 60 * 60 * 48,
static fn () => $championSkin->load('champion', 'chromas') static fn () => $championSkin->load('champion', 'chromas')
); );
$splashColor = Cache::remember( $splashColor = Cache::remember(
'championSkinSplashColorCache' . $championSkin->slug, 'championSkinSplashColorCache'.$championSkin->slug,
60 * 60 * 120, 60 * 60 * 120,
static fn () => getAverageColorFromImageUrl('https://wsrv.nl/?url=' . $championSkin->getSkinImageAttribute()) static fn () => getAverageColorFromImageUrl('https://wsrv.nl/?url='.$championSkin->getSkinImageAttribute())
); );
$skin->splash_color = $splashColor; $skin->splash_color = $splashColor;