1.7 KiB
1.7 KiB
Today Downloads
Route
- URL:
GET /downloads/today - Controller:
App\Http\Controllers\User\TodayDownloadsController::index()
Important scope note
This page is not inside /discover/*, but it is included here because it is discovery-adjacent and was requested together with the Discover surfaces.
What the page reads
This page does not use Meilisearch. It is a direct MySQL query over the download event log.
Query logic
The controller:
- Takes today's date
- Reads
artwork_downloads - Filters rows to
whereDate(created_at, today) - Groups by
artwork_id - Orders by
COUNT(*) DESC - Eager-loads each artwork and related user/category data
Effectively:
SELECT artwork_id, COUNT(*) AS num_downloads
FROM artwork_downloads
WHERE DATE(created_at) = today
GROUP BY artwork_id
ORDER BY num_downloads DESC
Only artworks that are currently public and published are allowed through whereHas('artwork', ...).
Data sources
- primary source:
artwork_downloads - supporting source:
artworks,users,user_profiles,categories
Unlike Most Downloaded, this page does not trust the aggregate artwork_stats.downloads counter for ranking.
It re-counts today's actual events.
Cache behavior
- no dedicated application cache in the controller
The page is as fresh as the underlying event log.
Background jobs and schedules
No page-specific cron is needed because it reads the raw event log directly.
The only prerequisite is that downloads are being recorded correctly by the download endpoint.
Notes
- This page is often the more operationally trustworthy answer to "what is being downloaded right now?"
- Because it counts raw rows, it is less sensitive to delayed aggregate-counter flushes than
Most Downloaded.