@php
$categoriesRequest ??= [];
$activeCategoryId ??= 0;
@endphp
@php
if (!isset($groupedCategories)) {
$groupedCategories = $categories->groupBy('parent_id');
}
$currentCategories = $groupedCategories->get($parentId ?? 0);
@endphp
@if($currentCategories)
@foreach ($currentCategories as $category)
@if (!empty($categoriesRequest) && $loop->first && !$category->parent_id)
-
{{ __('All categories') }}
@endif
-
in_array($category->id, $categoriesRequest) &&
($activeCategoryId == $category->id || $urlCurrent != route('public.single', $category->url)),
])>
@if ($hasChildren)
@include(Theme::getThemeNamespace('views.ecommerce.includes.categories'), [
'categories' => $groupedCategories,
'parentId' => $category->id,
])
@endif
@endforeach
@endif