mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
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:
@@ -2,6 +2,7 @@
|
||||
|
||||
use Intervention\Image\Drivers\Gd\Driver;
|
||||
use Intervention\Image\ImageManager;
|
||||
use App\Models\ChampionImage;
|
||||
|
||||
function getRoleIcon($roleName): string
|
||||
{
|
||||
@@ -64,3 +65,21 @@ function getRoleIconSvg($roleName): string
|
||||
|
||||
return $roleIcons[$roleName];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the champion image
|
||||
*
|
||||
* @param string $full_id
|
||||
* @param enum $type splash, uncentered_splash, loading, tile, icon, ability, video
|
||||
* @return string
|
||||
*/
|
||||
function getChampionImage($full_id, $type): string
|
||||
{
|
||||
$championImage = ChampionImage::where('full_id', $full_id)->where('type', $type)->first();
|
||||
|
||||
if (!$championImage) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $championImage->url;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user