@props([ 'name', 'options' => [], // array OR JSON string 'required' => false, 'class' => 'form-control', 'placeholder' => 'Select option', 'selected' => null, ]) @php // Keep old selected value if exists $selected = old($name, $selected); // Convert JSON string into an array if needed if (is_string($options)) { $decoded = json_decode($options, true); if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) { $options = $decoded; } } @endphp