A single directory view with the same spacing and chrome used across the frontend.
{{ number_format($categoryCount, 0, '.', ',') }} categories
@foreach($categories as $category)
@php
$childNames = $category->children
->take(3)
->pluck('name')
->filter()
->implode(' ยท ');
$extraChildCount = max($category->children->count() - 3, 0);
$icon = match (trim((string) ($category->icon ?? ''))) {
'laptop' => 'heroicon-o-computer-desktop',
'car' => 'heroicon-o-truck',
'home' => 'heroicon-o-home',
'shirt' => 'heroicon-o-shopping-bag',
'sofa' => 'heroicon-o-home-modern',
'football' => 'heroicon-o-trophy',
'briefcase' => 'heroicon-o-briefcase',
'wrench' => 'heroicon-o-wrench-screwdriver',
default => null,
};
$iconLabel = strtoupper(\Illuminate\Support\Str::substr($category->name, 0, 1));
@endphp
@if($icon)
@else
{{ $iconLabel }}
@endif
{{ number_format($category->children->count(), 0, '.', ',') }} subcategories
{{ $childNames !== '' ? $childNames : 'Open this category to browse available listings and subcategories.' }}
@if($extraChildCount > 0)
+{{ $extraChildCount }} more
@endif
@endforeach