diff --git a/app/Http/Controllers/ChampionSkinController.php b/app/Http/Controllers/ChampionSkinController.php index 76310c3..4341ce9 100644 --- a/app/Http/Controllers/ChampionSkinController.php +++ b/app/Http/Controllers/ChampionSkinController.php @@ -51,7 +51,25 @@ class ChampionSkinController extends Controller */ public function show(ChampionSkin $championSkin) { - // + $skin = Cache::remember( + 'championSkinShowCache' . $championSkin->slug, + 60 * 60 * 8, + function () use ($championSkin) { + return $championSkin->load('champion', 'chromas'); + } + ); + + $splashColor = Cache::remember( + 'championSkinSplashColorCache' . $championSkin->slug, + 60 * 60 * 24, + function () use ($championSkin) { + return getAverageColorFromImageUrl($championSkin->getSkinImageAttribute()); + } + ); + + $skin->splash_color = $splashColor; + + return view('skins.show', compact('skin')); } /** diff --git a/app/Models/SkinChroma.php b/app/Models/SkinChroma.php index df24186..62c9d34 100644 --- a/app/Models/SkinChroma.php +++ b/app/Models/SkinChroma.php @@ -35,6 +35,11 @@ class SkinChroma extends Model public function skin(): BelongsTo { - return $this->belongsTo(Skin::class); + return $this->belongsTo(ChampionSkin::class, 'full_skin_id', 'full_skin_id'); + } + + public function getChromaImageAttribute() + { + return 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/v1/champion-chroma-images/' . $this->skin->champion_id . '/' . $this->chroma_id . '.png'; } } diff --git a/app/View/Components/Skins/Grid_info.php b/app/View/Components/Skins/Grid_info.php new file mode 100644 index 0000000..91a37b5 --- /dev/null +++ b/app/View/Components/Skins/Grid_info.php @@ -0,0 +1,19 @@ + +

Heimerdinger Presents:

+

+ SKIN DETAILS

+

+ {{$skin->skin_name}}

+ + +
+
+
+
+
+ {{$skin->skin_name}} Splash Art +
+
+ +
+ +

+ {{$skin->skin_name}} Details

+ +
    +
  • + Riot Points Cost: + @if ($skin->rp_price == '99999') + Not Available for RP + @else + + {{ $skin->rp_price }} RP + @endif +
  • +
  • + Release Date: {{$skin->release_date}} +
  • +
  • + Rarity: {{$skin->rarity}} +
  • +
  • + Availability: {{$skin->availability}} +
  • +
  • + Chromas: @if ($skin->chromas->count() > 0) + {{$skin->chromas->count()}} + @else + None + @endif +
  • +
  • + Lootable: {{$skin->loot_eligible ? 'Yes' : 'No'}} +
  • +
  • + New Effects: {{$skin->new_effects ? 'Yes' : 'No'}} +
  • +
  • + New Animations: {{$skin->new_animations ? 'Yes' : 'No'}} +
  • +
  • + New Recall: {{$skin->new_recall ? 'Yes' : 'No'}} +
  • +
  • + New Voice: {{$skin->new_voice ? 'Yes' : 'No'}} +
  • +
  • + New Quotes: {{$skin->new_quotes ? 'Yes' : 'No'}} +
  • +
  • + Voice Actor: + @if(count($skin->voice_actor) < 1) + Unknown + @else + @foreach($skin->voice_actor as $voice_actor) + {{ $voice_actor }} + @endforeach + @endif +
  • +
  • + Splash Artist: + @if(count($skin->splash_artist) < 1) + Unknown + @else + @foreach($skin->splash_artist as $key => $splash_artist) + {{ $splash_artist }} + @if($key < count($skin->splash_artist) - 2) + , + @elseif($key == count($skin->splash_artist) - 2) + & + @endif + @endforeach + @endif +
  • + + +
+
+ + +
+
+

+ {{$skin->name}} Lore

+

+ {{$skin->lore}} +

+
+ +
+
+
+

+ {{$skin->name}} Chromas ({{count($skin->chromas)}})

+
+
+ @foreach($skin->chromas as $key => $chroma) +
+ + {{$chroma->chroma_name}} {{$chroma->skin_name}} ScreenShot + +
+ +

+ + {{$chroma->chroma_name}} + +

+
+
+ @endforeach +
+
+
+
+
+
+ diff --git a/resources/views/components/skins/paginatedlist.blade.php b/resources/views/components/skins/paginatedlist.blade.php index 53a565b..8d3621d 100644 --- a/resources/views/components/skins/paginatedlist.blade.php +++ b/resources/views/components/skins/paginatedlist.blade.php @@ -5,7 +5,7 @@

- Skins

+ Champion Skins
@@ -52,7 +52,7 @@

More details + href="/skin/{{$skin->slug}}">More details

diff --git a/resources/views/skins/show.blade.php b/resources/views/skins/show.blade.php new file mode 100644 index 0000000..b3fc98e --- /dev/null +++ b/resources/views/skins/show.blade.php @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + {{$skin->skin_name}} • Heimerdinger.LoL + + + + + + + + + + + + + + + + + + + + + + @vite(['resources/css/app.css', 'resources/js/app.js']) + + + + + + + + +@vite('resources/js/vert-scroll.js') + + + diff --git a/routes/api.php b/routes/api.php index 889937e..fa84410 100644 --- a/routes/api.php +++ b/routes/api.php @@ -13,7 +13,3 @@ use Illuminate\Support\Facades\Route; | be assigned to the "api" middleware group. Make something great! | */ - -Route::middleware('auth:sanctum')->get('/user', function (Request $request) { - return $request->user(); -}); diff --git a/routes/web.php b/routes/web.php index ad35c7d..4696756 100644 --- a/routes/web.php +++ b/routes/web.php @@ -23,3 +23,4 @@ Route::get('/champions', [ChampionController::class, 'index']); Route::get('/champion/{champion}', [ChampionController::class, 'show']); // Skins Route::get('/skins', [ChampionSkinController::class, 'index']); +Route::get('/skin/{championSkin}', [ChampionSkinController::class, 'show']);