mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
feat: role mapping to popular naming
While the database values match the ones internally used by Riot Games in the League of Legends client, this is not how most people call them. So we map them to the way people call them for SEO
This commit is contained in:
@@ -19,6 +19,35 @@ class ChampionRoles extends Model
|
|||||||
'roles' => 'array',
|
'roles' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function getRolesAttribute($value)
|
||||||
|
{
|
||||||
|
$mappedRoles = [];
|
||||||
|
foreach ($value as $role) {
|
||||||
|
switch ($role) {
|
||||||
|
case 'TOP':
|
||||||
|
$mappedRoles[] = 'Toplane';
|
||||||
|
break;
|
||||||
|
case 'JUNGLE':
|
||||||
|
$mappedRoles[] = 'Jungle';
|
||||||
|
break;
|
||||||
|
case 'MIDDLE':
|
||||||
|
$mappedRoles[] = 'Midlane';
|
||||||
|
break;
|
||||||
|
case 'BOTTOM':
|
||||||
|
$mappedRoles[] = 'Botlane';
|
||||||
|
break;
|
||||||
|
case 'UTILITY':
|
||||||
|
$mappedRoles[] = 'Support';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $mappedRoles;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function champion()
|
public function champion()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Champion::class);
|
return $this->belongsTo(Champion::class);
|
||||||
|
|||||||
Reference in New Issue
Block a user