Champion model represents a League of Legends champion with all their core information including stats, pricing, roles, and relationships to skins and other related data.
Source: source/app/Models/Champion.php
Properties
Database Columns
Auto-incrementing primary key
Unique Riot Games champion identifier. This is used as the foreign key for relationships.Database:
integer, unique indexMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:14Champion’s internal key identifier (e.g., “Ahri”, “MasterYi”)Database:
string, unique indexMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:15Champion’s display name (e.g., “Ahri”, “Master Yi”)Database:
stringMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:16Champion’s title (e.g., “the Nine-Tailed Fox”, “the Wuju Bladesman”)Database:
stringMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:17Champion’s complete backstory and lore textDatabase:
longTextMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:18Array of champion roles (e.g., [“Assassin”, “Mage”])Database:
jsonCasted to: array - automatically serialized/deserializedMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:19Model: source/app/Models/Champion.php:141Champion price in Blue EssenceDatabase:
integerMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:20Champion price in Riot PointsDatabase:
integerMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:21Champion’s resource type (e.g., “MANA”, “ENERGY”, “NONE”)Database:
stringAccessor: Returns human-readable format via getResourceTypeAttribute() mutatorMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:22Model: source/app/Models/Champion.php:32-55Champion’s attack type (e.g., “Melee”, “Ranged”)Database:
stringMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:23Champion’s adaptive damage type (e.g., “PHYSICAL_DAMAGE”, “MAGIC_DAMAGE”, “ADAPTIVE_DAMAGE”)Database:
stringAccessor: Returns human-readable format via getAdaptiveTypeAttribute() mutatorMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:24Model: source/app/Models/Champion.php:57-66Champion’s release dateDatabase:
stringMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:25Game patch version when the champion was releasedDatabase:
stringMigration: source/database/migrations/2023_10_25_180120_create_champions_table.php:26URL-friendly slug generated from champion name (used for routing)Database:
string, unique index, nullableAuto-generated: Uses Sluggable trait to generate from name fieldMigration: source/database/migrations/2023_11_01_135724_add_slug_to_champions.php:12Model: source/app/Models/Champion.php:68-80Record creation timestamp
Record last update timestamp
Relationships
skins()
Returns all skins belonging to this champion. Type:HasMany
Related Model: ChampionSkin
Foreign Key: champion_id
Source: source/app/Models/Champion.php:82-85
lanes()
Returns the lane/role statistics for this champion. Type:HasOne
Related Model: ChampionRoles
Foreign Key: champion_id
Source: source/app/Models/Champion.php:87-90
streamers()
Returns all streamers associated with this champion. Type:HasMany
Related Model: Streamer
Foreign Key: champion_id
Source: source/app/Models/Champion.php:92-95
Accessors & Methods
getResourceTypeAttribute($value)
Mutator that converts database resource type codes to human-readable format. Source:source/app/Models/Champion.php:32-55
Returns: string
Mapping:
BLOOD_WELL→ “Blood”MANA→ “Mana”ENERGY→ “Energy”NONE→ “None”- And more…
getAdaptiveTypeAttribute($value)
Mutator that converts database adaptive type codes to human-readable format. Source:source/app/Models/Champion.php:57-66
Returns: string
Mapping:
ADAPTIVE_DAMAGE→ “Adaptive”MAGIC_DAMAGE→ “Magical”PHYSICAL_DAMAGE→ “Physical”
getChampionImageAttribute($uncentered = false)
Returns the champion’s main splash art image URL. Source:source/app/Models/Champion.php:98-100
Parameters:
$uncentered(bool): Whether to return uncentered splash art
string - Image URL
getChampionImageTileAttribute()
Returns the champion’s tile image URL. Source:source/app/Models/Champion.php:102-105
Returns: string - Tile image URL
getChampionSquareImageAttribute()
Returns the champion’s square icon image URL from Community Dragon. Source:source/app/Models/Champion.php:107-110
Returns: string - Square icon URL
Ability Icon Accessors
Methods to retrieve ability icon URLs for each ability. Source:source/app/Models/Champion.php:113-136
Returns: string - Ability icon URL from Community Dragon CDN
getRouteKeyName()
Specifies that routes should use theslug field instead of id.
Source: source/app/Models/Champion.php:77-80
Returns: string - “slug”
Traits
HasFactory
Enables model factory support for testing and seeding. Source:source/app/Models/Champion.php:13
Sluggable
Automatically generates URL-friendly slugs from the champion name. Source:source/app/Models/Champion.php:14, 68-75
Configuration:
Fillable Attributes
The following attributes are mass-assignable: Source:source/app/Models/Champion.php:16-30
champion_idkeynametitlelorerolesprice_beprice_rpresource_typeattack_typeadaptive_typerelease_daterelease_patch