Laravel 5.1 how to use {{ old('') }} helper on blade file for radio inputs



PHP Snippet 1:

<input type="radio" name="geckoHatchling" value="1" @if(old('geckoHatchling')) checked @endif>

<input type="radio" name="geckoHatchling" value="0" @if(!old('geckoHatchling')) checked @endif>

PHP Snippet 2:

{!! Form::radio('geckoHatchling', '1', (Input::old('geckoHatchling') == '1'), array('id'=>'geckoHatchlingYes', 'class'=>'radio')) !!}
{!! Form::radio('geckoHatchling', '0', (Input::old('geckoHatchling') == '0'), array('id'=>'geckoHatchlingNo', 'class'=>'radio')) !!}

PHP Snippet 3:

echo Form::radio('geckoHatchling', '1', (Input::old('geckoHatchling') == '1'), array('id'=>'geckoHatchlingYes', 'class'=>'radio'));
echo Form::radio('geckoHatchling', '0', (Input::old('geckoHatchling') == '0'), array('id'=>'geckoHatchlingNo', 'class'=>'radio'));

PHP Snippet 4:

<input type="radio" name="geckoHatchling" id="geckoHatchlingYes" value="1" @if(Input::old('geckoHatchling')) checked @endif>
<input type="radio" name="geckoHatchling" id="geckoHatchlingNo" value="0" @if(!Input::old('geckoHatchling')) checked @endif>

PHP Snippet 5:

<input type="radio" name="geckoHatchling" value="1" class="radio" id="geckoHatchlingYes" <?php if(Input::old('geckoHatchling')== "1") { echo 'checked'; } ?> >
<input type="radio" name="geckoHatchling" value="0" class="radio" id="geckoHatchlingNo" <?php if(Input::old('geckoHatchling')== "0") { echo 'checked'; } ?> >

PHP Snippet 6:

<input type="radio" name="geckoHatchling" id="geckoHatchlingYes" value="1" {{(old('geckoHatchling') == '1') ? 'checked' : ''}}>

PHP Snippet 7:

<div> <input type="radio" name="role" value="teacher" @if(old('role') == 'teacher') checked @endif> </div>
        
<div> <input type="radio" name="role" value="student" @if(old('role') == 'student') checked @endif> </div>
        
<div> <input type="radio" name="role" value="assistant" @if(old('role') == 'assistant') checked @endif> </div>

PHP Snippet 8:

@if(old('role') checked @endif

PHP Snippet 9:

<input type"radio" name="active" value="1" {{old('active',user->active))?'checked',''}}/>
<input type"radio" name="active" value="0" {{old('active',user->active))?'','checked'}}/>

PHP Snippet 10:

<input type"radio" name="active" value="1" @checked(old('active',$user->active))/>
<input type"radio" name="active" value="0" @checked(!old('active',$user->active))/>