@php $categories = \App\Models\Category::withCount(['competitions' => function ($query) { $query->where('closed', false)->where('draw_date', '>', now()); }]) ->orderBy('sort_order', 'asc') ->orderBy('competitions_count', 'desc') ->get(); @endphp @if($categories->isNotEmpty())

🔗 Competition Category Quick Links

@foreach($categories as $category) @php // Singularize and format name (e.g. Cars -> Car Competitions, Watches -> Watch Competitions) $cleanName = \Illuminate\Support\Str::singular($category->name); $anchorText = "{$cleanName} Competitions"; @endphp {{ $category->icon }}
{{ $anchorText }} @if($category->competitions_count > 0) {{ $category->competitions_count }} active {{ \Illuminate\Support\Str::plural('draw', $category->competitions_count) }} @else Browse draws @endif
@endforeach
@endif