feat: skinline tags

This commit is contained in:
Rico van Zelst
2023-11-07 13:16:46 +01:00
parent aea82ff0f6
commit ab15e38ac0
3 changed files with 45 additions and 16 deletions

View File

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

View File

@@ -1,5 +1,6 @@
@php use Carbon\Carbon; @endphp @php use Carbon\Carbon; @endphp
<?php /** @var App\Models\ChampionSkin $skin */ ?> <?php
/** @var App\Models\ChampionSkin $skin */ ?>
<section class="text-white bg-stone-900"> <section class="text-white bg-stone-900">
<div class="max-w-screen-xl px-4 py-8 mx-auto sm:py-12 sm:px-6 lg:py-16 lg:px-8"> <div class="max-w-screen-xl px-4 py-8 mx-auto sm:py-12 sm:px-6 lg:py-16 lg:px-8">
@@ -21,7 +22,7 @@
<div class="flex flex-col"> <div class="flex flex-col">
<div class="flex flex-col items-center justify-center"> <div class="flex flex-col items-center justify-center">
<img loading="lazy" class="border-2 border-orange-400/40 rounded-xl" <img loading="lazy" class="border-2 border-orange-400/40 rounded-xl"
src="{{ $skin->getSkinImageAttribute() }}" alt="{{ $skin->skin_name }} Splash Art"> src="{{ $skin->getSkinImageAttribute() }}" alt="{{ $skin->skin_name }} Splash Art">
<div class="flex flex-col items-center justify-center"> <div class="flex flex-col items-center justify-center">
<h2 class="mt-4 text-xl font-bold text-white">{{ $skin->skin_name }}</h2> <h2 class="mt-4 text-xl font-bold text-white">{{ $skin->skin_name }}</h2>
<h3 class=" text-stone-200">Released <h3 class=" text-stone-200">Released
@@ -30,19 +31,31 @@
'join' => true, 'join' => true,
]) }} ]) }}
</h3> </h3>
<p class="mt-1 text-sm text-stone-300">
@foreach($skin->associated_skinline as $skinline)
<span class="sr-only">Associated Skinline:</span>
<span
class="my-2 bg-orange-100 text-orange-800 text-xs font-medium
mr-2 px-2.5 py-0.5 rounded
border border-orange-300
">
{{$skinline}}</span>
@endforeach
<p class=" text-sm text-stone-300">
@if ($skin->rp_price == '99999') @if ($skin->rp_price == '99999')
Not Available for RP Not Available for RP
@else @else
{{ $skin->rp_price }} RP {{ $skin->rp_price }} RP
@endif @endif
</p>
</p> @if ($skin->loot_eligible)
<p class="mt-1 text-sm italic text-stone-300"> <p class="mt-1 text-sm italic text-stone-300">
@if ($skin->loot_eligible)
Can be obtained from loot Can be obtained from loot
@endif </p>
</p> @endif
</div> </div>
</div> </div>
</div> </div>

View File

@@ -25,18 +25,33 @@
alt="{{ $skin->skin_name }} Splash Art"> alt="{{ $skin->skin_name }} Splash Art">
<div class="flex flex-col items-center justify-center"> <div class="flex flex-col items-center justify-center">
<h2 class="mt-4 text-xl font-bold text-white">{{ $skin->skin_name }}</h2> <h2 class="mt-4 text-xl font-bold text-white">{{ $skin->skin_name }}</h2>
<p class="mt-1 text-sm text-stone-300">
<div class="my-1 ">
<span class="sr-only">Associated Skinline:</span>
@foreach($skin->associated_skinline as $skinline)
<span
class="bg-orange-100 text-orange-800 text-xs font-medium
@if(!$loop->last) mr-2 @endif px-2.5 rounded
border border-orange-300
">
{{$skinline}}</span>
@endforeach
</div>
<p class="text-sm text-stone-300">
@if ($skin->rp_price == '99999') @if ($skin->rp_price == '99999')
Not Available for RP Not Available for RP
@else @else
{{ $skin->rp_price }} RP {{ $skin->rp_price }} RP
@endif @endif
</p> </p>
<p class="mt-1 text-sm italic text-stone-300">
@if ($skin->loot_eligible) @if ($skin->loot_eligible)
<p class="mt-1 text-sm italic text-stone-300">
Can be obtained from loot Can be obtained from loot
@endif </p>
</p> @endif
</div> </div>
</div> </div>
</div> </div>