From 01b3e35e87a720f890bd5f5df62baa63eacd8523 Mon Sep 17 00:00:00 2001 From: Rico van Zelst Date: Sun, 14 Apr 2024 13:46:53 +0200 Subject: [PATCH] fix: Update Champion image URLs from CDN Cdragon to RAW - Refactored the Champion model to use new image URLs for different attributes. - Updated blade templates to fetch champion images with correct URLs. --- app/Models/Champion.php | 16 ++--- .../components/champions/grid_info.blade.php | 2 +- .../components/champions/list_all.blade.php | 60 +++++++++---------- 3 files changed, 32 insertions(+), 46 deletions(-) diff --git a/app/Models/Champion.php b/app/Models/Champion.php index 73576e5..ff5d510 100644 --- a/app/Models/Champion.php +++ b/app/Models/Champion.php @@ -99,26 +99,18 @@ class Champion extends Model return $this->hasMany(Streamer::class, 'champion_id', 'champion_id'); } - public function getChampionImageAttribute($centered = true): string + public function getChampionImageAttribute(): string { - $url = 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/splash-art'; - - return $centered ? $url.'/centered' : $url; + return 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/' . $this->champion_id . '/' . $this->champion_id . '000.jpg'; } - - public function getChampionImageLoadingAttribute(): string - { - return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/portrait'; - } - public function getChampionImageTileAttribute(): string { - return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/tile'; + return 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/v1/champion-tiles/' . $this->champion_id . '/' . $this->champion_id . '000.jpg'; } public function getChampionSquareImageAttribute(): string { - return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/square'; + return 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/v1/champion-icons/' . $this->champion_id . '.png'; } public function getChampionAbilityIconQAttribute(): string diff --git a/resources/views/components/champions/grid_info.blade.php b/resources/views/components/champions/grid_info.blade.php index d47bb64..1f68a5a 100644 --- a/resources/views/components/champions/grid_info.blade.php +++ b/resources/views/components/champions/grid_info.blade.php @@ -17,7 +17,7 @@
- {{ $champion->name }} Splash Art
diff --git a/resources/views/components/champions/list_all.blade.php b/resources/views/components/champions/list_all.blade.php index ab7f976..be9a120 100644 --- a/resources/views/components/champions/list_all.blade.php +++ b/resources/views/components/champions/list_all.blade.php @@ -8,32 +8,29 @@ class="text-3xl font-bold text-center text-transparent uppercase sm:text-4xl bg-gradient-to-bl from-orange-300 to-orange-500 bg-clip-text"> Champions
- +
- @foreach($champions as $key => $champion) + @foreach ($champions as $key => $champion)
-
- - {{ $champion->name }} Splash Art + border border-stone-800 hover:border-orange-500/10 hover:shadow-orange-500/10 @foreach ($roles[$key]->roles as $lane) POS-{{ $lane }} @endforeach"> +

- - {{ $champion->name }} + + {{ $champion->name }}

{{ $champion->title }} @@ -41,30 +38,27 @@

- @foreach($roles[$key]->roles as $lane) - {{$lane}} + @foreach ($roles[$key]->roles as $lane) + {{ $lane }} - theme('dark')->position('bottom')->pop($lane)}} - @if($key < 8) loading="auto" @else loading="lazy" - @endif src="{{getRoleIcon($lane)}}" - alt="{{$lane}} Icon" + theme('dark')->position('bottom')->pop($lane) }} + @if ($key < 8) loading="auto" @else loading="lazy" @endif + src="{{ getRoleIcon($lane) }}" alt="{{ $lane }} Icon" class="mr-1 w-7 h-7">

- @endforeach - -
-

- - - -

-
-
-
-
@endforeach + +
+

+ + + +

+
+
+ @endforeach +
+