{{-- Recursive formation tree node. Expects: $node, $byParent, $depth --}} @php $children = $byParent[$node->id] ?? collect(); $levelColor = ['portfolio'=>'primary','area'=>'info','division'=>'secondary','station'=>'success'][$node->level] ?? 'secondary'; $childLevel = \App\Models\Formation::childLevel($node->level); @endphp @if($children->isNotEmpty())@endif {{ $node->level_label }} {{ $node->name }} @if($node->code)({{ $node->code }})@endif @if($node->users_count){{ $node->users_count }} ppl@endif @unless($node->is_active)Inactive@endunless @if($childLevel) + {{ \App\Models\Formation::LEVELS[$childLevel] }} @endif Edit
@csrf
@foreach($children as $child) @include('admin.formations._node', ['node' => $child, 'byParent' => $byParent, 'depth' => $depth + 1]) @endforeach