mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 18:20:48 +01:00
- Moved the import statement for `Champion` and `ChampionSkin` models in their respective controllers to improve code organization. - Refactored image attribute methods in the `Champion` model to use string interpolation for better readability. - Refactored image attribute methods in the `ChampionSkin` model to use string interpolation for better readability. This commit improves code organization and readability by refactoring import statements and using string interpolation for image attribute methods.
82 lines
2.1 KiB
PHP
82 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Champion extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'champion_id',
|
|
'key',
|
|
'name',
|
|
'title',
|
|
'lore',
|
|
'roles',
|
|
'price_be',
|
|
'price_rp',
|
|
'resource_type',
|
|
'attack_type',
|
|
'adaptive_type',
|
|
'release_date',
|
|
'release_patch',
|
|
];
|
|
|
|
protected $casts = [
|
|
'roles' => 'array',
|
|
];
|
|
|
|
public function skins()
|
|
{
|
|
return $this->hasMany(ChampionSkin::class);
|
|
}
|
|
|
|
public function getChampionImageAttribute()
|
|
{
|
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/splash-art';
|
|
}
|
|
|
|
public function getChampionImageLoadingAttribute()
|
|
{
|
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/portrait';
|
|
}
|
|
|
|
public function getChampionImageTileAttribute()
|
|
{
|
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/tile';
|
|
}
|
|
|
|
public function getChampionSquareImageAttribute()
|
|
{
|
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/square';
|
|
}
|
|
|
|
public function getChampionAbilityIconQAttribute()
|
|
{
|
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/q';
|
|
}
|
|
|
|
public function getChampionAbilityIconWAttribute()
|
|
{
|
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/w';
|
|
}
|
|
|
|
public function getChampionAbilityIconEAttribute()
|
|
{
|
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/e';
|
|
}
|
|
|
|
public function getChampionAbilityIconRAttribute()
|
|
{
|
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/r';
|
|
}
|
|
|
|
public function getChampionAbilityIconPAttribute()
|
|
{
|
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/p';
|
|
}
|
|
}
|