@props([ 'name', 'required' => false, 'options' => [], // Can be array OR JSON string 'class' => '', 'wrapper_class' => '', ]) @php // If options is JSON string → convert to array if (is_string($options)) { $decoded = json_decode($options, true); if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) { $options = $decoded; } } @endphp @foreach($options as $value => $text) @php $id = $name . '_' . $value; @endphp