Merge pull request #74 from rico-vz/analysis-RPyo79

Apply fixes from StyleCI
This commit is contained in:
Rico
2024-01-06 00:16:42 +01:00
committed by GitHub
4 changed files with 9 additions and 9 deletions

View File

@@ -17,9 +17,9 @@ class ChampionController extends Controller
{ {
$eightHoursInSeconds = 60 * 60 * 8; $eightHoursInSeconds = 60 * 60 * 8;
$champions = Cache::remember('championsListAllCache', $eightHoursInSeconds, static fn() => Champion::orderBy('name')->get()); $champions = Cache::remember('championsListAllCache', $eightHoursInSeconds, static fn () => Champion::orderBy('name')->get());
$roles = Cache::remember('championsRolesCache', $eightHoursInSeconds, static fn() => ChampionRoles::orderBy('champion_name')->get()); $roles = Cache::remember('championsRolesCache', $eightHoursInSeconds, static fn () => ChampionRoles::orderBy('champion_name')->get());
return view('champions.index', ['champions' => $champions, 'roles' => $roles]); return view('champions.index', ['champions' => $champions, 'roles' => $roles]);
} }
@@ -48,12 +48,12 @@ class ChampionController extends Controller
$eightHoursInSeconds = 60 * 60 * 8; $eightHoursInSeconds = 60 * 60 * 8;
$dayInSeconds = 60 * 60 * 24; $dayInSeconds = 60 * 60 * 24;
$champion = Cache::remember('championShowCache' . $champion->slug, $eightHoursInSeconds, static fn() => $champion->load('skins', 'lanes')); $champion = Cache::remember('championShowCache' . $champion->slug, $eightHoursInSeconds, static fn () => $champion->load('skins', 'lanes'));
$splashColor = Cache::remember( $splashColor = Cache::remember(
'championSplashColorCache' . $champion->slug, 'championSplashColorCache' . $champion->slug,
$dayInSeconds, $dayInSeconds,
static fn() => getAverageColorFromImageUrl($champion->getChampionImageAttribute()) static fn () => getAverageColorFromImageUrl($champion->getChampionImageAttribute())
); );
$champion->splash_color = $splashColor; $champion->splash_color = $splashColor;

View File

@@ -57,13 +57,13 @@ class ChampionSkinController extends Controller
$skin = Cache::remember( $skin = Cache::remember(
'championSkinShowCache' . $championSkin->slug, 'championSkinShowCache' . $championSkin->slug,
60 * 60 * 8, 60 * 60 * 8,
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 * 24, 60 * 60 * 24,
static fn() => getAverageColorFromImageUrl($championSkin->getSkinImageAttribute()) static fn () => getAverageColorFromImageUrl($championSkin->getSkinImageAttribute())
); );
$skin->splash_color = $splashColor; $skin->splash_color = $splashColor;

View File

@@ -9,10 +9,10 @@ class HomeController extends Controller
{ {
public function index() public function index()
{ {
$upcomingSkins = Cache::remember('upcomingSkins_home', 60 * 4, static fn() => ChampionSkin::where('availability', 'Upcoming') $upcomingSkins = Cache::remember('upcomingSkins_home', 60 * 4, static fn () => ChampionSkin::where('availability', 'Upcoming')
->orderBy('release_date', 'desc')->get()); ->orderBy('release_date', 'desc')->get());
$latestSkins = Cache::remember('latestSkins_home', 60 * 4, static fn() => ChampionSkin::where('availability', 'Available') $latestSkins = Cache::remember('latestSkins_home', 60 * 4, static fn () => ChampionSkin::where('availability', 'Available')
->orderBy('release_date', 'desc')->take(9)->get()); ->orderBy('release_date', 'desc')->take(9)->get());
return view('home', [ return view('home', [

View File

@@ -13,7 +13,7 @@ class SaleController extends Controller
file_get_contents('https://api.shop.riotgames.com/v3/collections/'), file_get_contents('https://api.shop.riotgames.com/v3/collections/'),
true true
); );
$salesData = array_filter($shopData, static fn($collection) => $collection['path'] === '/event/sales'); $salesData = array_filter($shopData, static fn ($collection) => $collection['path'] === '/event/sales');
return reset($salesData)['dynamicCollection']['discountedProductsByProductType'] ?? []; return reset($salesData)['dynamicCollection']['discountedProductsByProductType'] ?? [];
}); });