@php if (!isset($groupedOptions)) { if (! $options instanceof \Illuminate\Support\Collection) { $options = collect($options); } $groupedOptions = $options->groupBy('parent_id'); } $currentOptions = $groupedOptions->get($parentId = $parentId ?? 0); @endphp @if($currentOptions) @foreach ($currentOptions as $option) @if ($groupedOptions->has($option->id)) @include('core/base::forms.partials.nested-select-option', [ 'options' => $groupedOptions, 'indent' => $indent . '  ', 'parentId' => $option->id, 'selected' => $selected, ]) @endif @endforeach @endif