@foreach ($subcategories as $sub) @if(($sub->uuid != @$categoryId)) @endif @if (count($sub->childs) > 0) @php // Creating parents list separated by ->. $parents = $parent . ' -> ' . $sub->name; @endphp @include('admin.category.subcategories', ['subcategories' => $sub->childs, 'parent' => $parents, 'product' => @$product, 'assignedCategory' => @$assignedCategory, 'parentId' => @$parentId, 'categoryId' => @$categoryId]) @endif @endforeach