SummonerEmoteController handles HTTP requests for the summoner emote catalog with search, filtering, and administrative CRUD operations.
Overview
Located atsource/app/Http/Controllers/SummonerEmoteController.php, this controller:
- Displays paginated emote catalog (72 emotes per page)
- Filters by title
- Sorts by emote ID (newest first)
- Implements 1-hour caching with query-specific cache keys
- Provides full CRUD operations with authorization
- Returns JSON responses for API operations
Class Definition
Routes
Defined insource/routes/web.php:55:
Methods
index()
Displays a filterable, paginated listing of summoner emotes.Query Parameters
Filter by emote title (exact match)Example:
?filter[title]=HappyPage number for pagination (72 emotes per page)Example:
?page=2Return Value
Rendered
emotes.index Blade templateView Data
Paginated collection of summoner emotes (72 per page)
Cache Strategy
Emotes are cached for 1 hour with a unique cache key per query combination using MD5 hash of serialized query parameters.
emotes_{md5_hash_of_query}
Examples:
emotes_d41d8cd98f00b204e9800998ecf8427e(no filters)emotes_b2e4a8f9c1d6e5f4a3b2c1d0e9f8a7b6(with filters)
Default Sorting
Emotes are sorted by
emote_id in descending order (newest emotes first). The - prefix indicates descending sort.Usage Examples
show()
Returns a specific emote (JSON response).Parameters
SummonerEmote model instance (automatically resolved via route model binding)
Return Value
Individual summoner emote model as JSON
This method returns JSON directly, not a view. Useful for API endpoints.
store()
Creates a new summoner emote (requires authorization).Authorization
Validation Rules
Riot Games API emote ID
Emote display title/name
CDN URL for the emote image
Return Value
Newly created SummonerEmote model instance (JSON)
update()
Updates an existing summoner emote (requires authorization).Authorization
Parameters
Emote to update (resolved via route model binding)
Validation Rules
Riot Games API emote ID
Emote display title/name
CDN URL for the emote image
Return Value
Updated SummonerEmote model instance (JSON)
destroy()
Deletes a summoner emote (requires authorization).Authorization
Parameters
Emote to delete (resolved via route model binding)
Return Value
Empty JSON response with 200 status code
Authorization
Unlike the SummonerIconController, this controller implements Laravel’s authorization policies:Authorization policies should be defined in
app/Policies/SummonerEmotePolicy.php to control who can create, update, and delete emotes.Spatie Query Builder
This controller uses Spatie Query Builder for filtering:Allowed Filters
title (exact match)
title (exact match)
Column:
titleType: Exact matchExample: ?filter[title]=Happy Face matches emotes with exactly “Happy Face” as the titlePagination
Number of emotes displayed per page
Differences from SummonerIconController
Authorization
Emote controller has authorization checks on CRUD operations
Fewer Filters
Only title filtering (no esports or year filters)
JSON Responses
show() returns JSON instead of a view
Simpler Data
Emotes have simpler schema than icons
Performance Considerations
Query-Specific Caching
Each unique query combination gets its own cache key
1-Hour Cache
Emotes cached for 1 hour per query
Large Pages
72 emotes per page reduces number of requests
Indexed Queries
Ensure title column is indexed for fast filtering
Related Documentation
SummonerEmote Model
View the SummonerEmote model API reference
Assets Feature
Learn about the game assets browsing feature
Icon Controller
View the icon controller documentation
Architecture
Understand the MVC architecture