netojose / laravel-bootstrap-4-forms

Bootstrap 4 forms for Laravel 5/6/7/8
MIT License
183 stars 58 forks source link

pre-select radio not working #98

Open wrabit opened 4 years ago

wrabit commented 4 years ago

Even though the model value is === 0, it is not pre-selecting the radio when:

{!! Form::open()->fill($model !!}
{!! Form::radio('has_tickets', 'No', 0) !!}

image

<?= $model->has_tickets === 0 ? 'true' : 'false' ?>

Returns 'true';

wrabit commented 4 years ago

The issue is caused by type hinting the $value argument as a string in the checkbox and radio methods:

https://github.com/netojose/laravel-bootstrap-4-forms/blob/a90c5ada728828793bd81347bdff38e2d2bd6a16/src/FormService.php#L440

Can I ask why? Why not just let the developer pass through their own raw variable. So number can be with or without quotes?