feat: Add functionality to retrieve champion images from the database

- Added a new function `getChampionImage` to fetch champion images based on ID and type.
- Created a new model `ChampionImage` to store champion image details in the database.
- Implemented seeding of champion images using `ChampionImageSeeder`.
- Updated usage of champion images in existing methods.
This commit is contained in:
Rico van Zelst
2024-05-02 00:50:51 +02:00
parent 80fc3200c6
commit 6d2731f1d3
8 changed files with 138 additions and 18 deletions

View File

@@ -74,11 +74,7 @@ class ChampionSkin extends Model
public function getSkinImageAttribute(bool $uncentered = false): string
{
$championName = strtolower(str_replace([' ', "'"], ['', ''], $this->champion->name));
$imagePath = $uncentered ? 'uncentered_' : 'centered_';
$imageUrl = 'https://raw.communitydragon.org/pbe/plugins/rcp-be-lol-game-data/global/default/assets/characters/'.$championName.'/skins/skin'.str_pad($this->skin_id, 2, '0', STR_PAD_LEFT).'/images/'.$championName.'_splash_'.$imagePath.$this->skin_id.'.jpg';
return $imageUrl;
return getChampionImage($this->full_skin_id, $uncentered ? 'uncentered_splash' : 'splash');
}
public function getSkinImageLoadingAttribute(): string