{{ $loop->iteration }} @if($item->hasChildren()) @endif @for($i = 1; $i < $level; $i++) @endfor {{ $item->label ?? 'Untitled' }} @php $nameField = ['head', 'subHead', 'subSubHead', 'subSubSubHead'][$level - 1] ?? 'head'; @endphp {{ $item->$nameField ?? '-' }} Level {{ $level }} @php $linkField = ['head_link', 'subHead_link', 'subSubHead_link', 'subSubSubHead_link'][$level - 1] ?? 'head_link'; @endphp @if($item->$linkField) {{ Str::limit($item->$linkField, 30) }} @elseif($item->route_name) {{ $item->route_name }} @else # @endif @if($item->route_name) {{ $item->route_name }} @else - @endif @if($item->icon) @else - @endif
is_active ? 'checked' : '' }}>
@if($item->canHaveChildren()) @endif
@csrf @method('DELETE')
@php // Check if children exists and has items (works for both Collection and array) $hasChildren = false; $childrenList = []; if (isset($item->children)) { if ($item->children instanceof \Illuminate\Support\Collection) { $hasChildren = $item->children->count() > 0; $childrenList = $item->children; } elseif (is_array($item->children)) { $hasChildren = count($item->children) > 0; $childrenList = $item->children; } } @endphp @if($hasChildren) @foreach($childrenList as $child) @include('admin.navigation.partials.tree-row', ['item' => $child, 'level' => $level + 1]) @endforeach @endif