@php // Closure to convert string to array for radios/selects $convertStringToArray = function($string) { $result = []; if(!empty($string)){ foreach(explode(',', $string) as $part){ $values = explode('##', $part); if(count($values) === 2){ $result[] = [ 'value' => $values[0], 'label' => ucfirst($values[1]) ]; } } } return $result; }; // Group fields by group_id $formGroups = []; foreach($formList as $field){ $formGroups[$field->group_id][] = $field; } @endphp
@csrf @if(isset($course)) @endif @if(isset($page)) @endif @foreach($formGroups as $groupId => $fields) @php $firstField = $fields[0]; $repeatClass = ($firstField->repeat === 'Y') ? ' repeatIt'.$groupId : ''; @endphp {{-- Form Group Title --}}
{{-- Repeat button if applicable --}} @if($firstField->repeat === 'Y') @endif @endforeach