@props([
'name',
'required' => false,
'options' => [], // Can be array OR JSON string
'radio_class' => '',
'label_class' => '',
'label' => true,
])
@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
@if($label)
@endif
@endforeach