php - radio checked lowest value in blade -
the following laravel blade code. want automatically check radio lowest value.
{ @foreach($service_stages $ss) <input class="" id="money" name="money" type="radio" id="" value="{{$ss->money}}" onclick="generatedate()" checked>{{$ss->money}} @endforeach }
first write code find smallest value (e.g. in controller). save variable provide blade view. lets assume have in variable $smallestvalue
can try following:
@foreach($service_stages $ss) {{ form::radio('money', $ss->money, ($ss->money == $smallestvalue) ? true : false , ['id' => 'money', 'onclick' => 'generatedate()']) }} @endforeach
this set checked="checked"
if $ss->money == $smallestvalue
.
Comments
Post a Comment