@php echo __('labels.title.subcategories'); @endphp
@if ($category->descendants->count())
@php
$traverse = function ($categories, $prefix = '-') use (&$traverse, $segments) {
foreach ($categories as $category) {
@endphp
- {{ $prefix.' '.$category->name }} ({{ $category->posts->count() }})
@php
$traverse($category->children, $prefix.'-');
}
};
$traverse($category->descendants->toTree());
@endphp
@else
@php echo __('messages.category.no_subcategories'); @endphp
@endif