So I am now working with the update part of my program, now i want to populate my forms with the older records from my database to edit it. Now my problem is the radio button, how can select the true one. I tried this code, i use if on my radio buttons
{{ Form::label('Type','Type')}}
{{ Form::radio('ctype', '1',if(($item->bname)==1){true}) }}
{{ Form::label('Rooster','Rooster')}}
{{ Form::radio('ctype', '0') }}
{{ Form::label('Hen','Hen')}}
But I just get error 500, please help
In the documentation it says:
echo Form::radio('name', 'value', true);
So you should go this way:
{{ Form::radio('ctype', '1', $item->bname == 1) }}
You shouldn't need any additional brackets. Third param is a simple boolean value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With