@php $rootGroups = $optionGroups->whereNull('parent_group_id'); @endphp @if ($rootGroups->isNotEmpty()) @foreach ($rootGroups as $group) @php $fieldName = 'listing_options['.$group->key.']'; $selectedValue = $selectedOptions[$group->key] ?? ''; $childGroup = $optionGroups->firstWhere('parent_group_id', $group->id); @endphp
@if ($group->type === 'select') @elseif ($group->type === 'number') is_required ? 'required' : '' }} > @else is_required ? 'required' : '' }} > @endif
@if ($childGroup) @php $childFieldName = 'listing_options['.$childGroup->key.']'; $childSelected = $selectedOptions[$childGroup->key] ?? ''; @endphp
@endif @endforeach @endif