{{ $categories[0]->name }}
-
@foreach ($categories[0]->children as $subCategory)
- {{ $subCategory->name }} @endforeach
@php $categories = null; $categoryRepository = app('Webkul\Category\Repositories\CategoryRepository'); $keyIndex = array_key_first($category); $categoryList = ! is_numeric($keyIndex) ? array_values($category) : []; foreach($category as $index => $categoryDetail) { $categorySlug = $index; if (empty($categoryList)) { $categorySlug = $categoryDetail; } $categories[] = $categoryRepository->findByPath($categorySlug); } @endphp @if (! empty($categories))