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