mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 18:20:48 +01:00
🎨 Champion + Skin databases
This commit is contained in:
81
app/Models/Champion.php
Normal file
81
app/Models/Champion.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?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';
|
||||
}
|
||||
}
|
||||
58
app/Models/ChampionSkin.php
Normal file
58
app/Models/ChampionSkin.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ChampionSkin extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'champion_id',
|
||||
'full_skin_id',
|
||||
'skin_id',
|
||||
'skin_name',
|
||||
'lore',
|
||||
'availability',
|
||||
'loot_eligible',
|
||||
'rp_price',
|
||||
'raritiy',
|
||||
'release_date',
|
||||
'associated_skinline',
|
||||
'new_effects',
|
||||
'new_animations',
|
||||
'new_recall',
|
||||
'new_voice',
|
||||
'new_quotes',
|
||||
'voice_actor',
|
||||
'splash_artist',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'associated_skinline' => 'array',
|
||||
'voice_actor' => 'array',
|
||||
'splash_artist' => 'array',
|
||||
];
|
||||
|
||||
public function champion()
|
||||
{
|
||||
return $this->belongsTo(Champion::class);
|
||||
}
|
||||
|
||||
public function getSkinImageAttribute()
|
||||
{
|
||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/splash-art/centered/skin/' . $this->skin_id;
|
||||
}
|
||||
|
||||
public function getSkinImageLoadingAttribute()
|
||||
{
|
||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/portrait/skin/' . $this->skin_id;
|
||||
}
|
||||
|
||||
public function getSkinImageTileAttribute()
|
||||
{
|
||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/tile/skin/' . $this->skin_id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user