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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -