Homepage
- Add HomepageService with hero, trending (award-weighted), fresh uploads,
popular tags, creator spotlight (weekly uploads ranking), and news sections
- Add React components: HomePage, HomeHero, HomeTrending, HomeFresh,
HomeTags, HomeCreators, HomeNews (lazy-loaded below the fold)
- Wire home.blade.php with JSON props, SEO meta, JSON-LD, and hero preload
- Add HomePage.jsx to vite.config.js inputs
Profile page
- Hero banner with random user artwork as background + dark gradient overlay
- Favourites section uses real Artwork models + <x-artwork-card> for CDN URLs
- Newest artworks grid: gallery-grid → grid grid-cols-2 gap-4
Edit Profile page (user.blade.php)
- Add hero banner (featured wallpaper/photography via artwork_features,
content_type_id IN [2,3]) sourced in UserController
- Remove bg-deep from outer wrapper; card backgrounds: bg-panel → bg-nova-800
- Remove stray AI-generated tag fragment from template
Author profile links
- Fix all /@username routes in: HomepageService, MonthlyCommentatorsController,
LatestCommentsController, MyBuddiesController and corresponding blade views
Legacy view namespace
- Register View::addNamespace('legacy', resource_path('views/_legacy'))
in AppServiceProvider::boot()
- Convert all view('legacy.x') and @include('legacy.x') calls to legacy::x
- Migrate legacy views to resources/views/_legacy/ with namespace support
69 lines
2.5 KiB
PHP
69 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Legacy;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Models\ArtworkDownload;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Illuminate\Support\Str;
|
|
use Carbon\Carbon;
|
|
|
|
class TodayDownloadsController extends Controller
|
|
{
|
|
public function index(Request $request)
|
|
{
|
|
$hits = 30;
|
|
|
|
// Filter downloads created today and join to artworks that are public, approved and published
|
|
$today = Carbon::now()->toDateString();
|
|
|
|
$query = ArtworkDownload::with(['artwork'])
|
|
->whereDate('created_at', $today)
|
|
->whereHas('artwork', function ($q) {
|
|
$q->public()->published()->whereNull('deleted_at');
|
|
})
|
|
->selectRaw('artwork_id, COUNT(*) as num_downloads')
|
|
->groupBy('artwork_id')
|
|
->orderByDesc('num_downloads');
|
|
|
|
$paginator = $query->paginate($hits)->withQueryString();
|
|
|
|
// Map to the legacy browse shape
|
|
$paginator->getCollection()->transform(function ($row) {
|
|
// $row is a stdClass with artwork_id and num_downloads
|
|
$art = $row->artwork ?? null;
|
|
// If Eloquent didn't eager load artwork (group queries sometimes don't), fetch it
|
|
if (! $art && isset($row->artwork_id)) {
|
|
$art = \App\Models\Artwork::find($row->artwork_id);
|
|
}
|
|
|
|
$name = $art->title ?? null;
|
|
$picture = $art->file_name ?? null;
|
|
$ext = pathinfo($picture ?? '', PATHINFO_EXTENSION) ?: 'jpg';
|
|
$encoded = null; // legacy encoding unavailable; leave null
|
|
$present = $art ? \App\Services\ThumbnailPresenter::present($art, 'md') : null;
|
|
$thumb = $present ? $present['url'] : '/gfx/sb_join.jpg';
|
|
$categoryId = $art->categories->first()->id ?? null;
|
|
|
|
return (object) [
|
|
'id' => $art->id ?? null,
|
|
'name' => $name,
|
|
'picture' => $picture,
|
|
'slug' => $art->slug ?? Str::slug($name ?? ''),
|
|
'ext' => $ext,
|
|
'encoded' => $encoded,
|
|
'thumb' => $thumb,
|
|
'thumb_srcset' => $thumb,
|
|
'category' => $categoryId,
|
|
'num_downloads' => $row->num_downloads ?? 0,
|
|
'gid_num' => $categoryId ? ((int) $categoryId % 5) * 5 : 0,
|
|
];
|
|
});
|
|
|
|
$page_title = 'Today Downloaded Artworks';
|
|
|
|
return view('legacy::browse', ['page_title' => $page_title, 'artworks' => $paginator]);
|
|
}
|
|
}
|