How to keep the radio or checkbox selected by the user in the event of an laravel form validation error

when the user submits the form, the form contains radio or checkbox, if it is input or textarea, you can get the value stored in session through the old () function, but if it is radio or checkbox, how can it be selected by comparing the values in old ()?

see the following figure for details:

laravel radiocheckbox

Code snippet:

<div class="form-group row mb-4">
    <label for="staticPhone" class="col-md-2 col-form-label"></label>
    <div class="col-md-10">
        <input type="text" name="phone" class="form-control" id="staticPhone" value="{{ old("phone") ? old("phone") : $user->phone }}" placeholder="">
        <small class="form-text text-muted">[] </small>
    </div>
</div>

<div class="form-group row mb-4">
    <label class="col-md-2 col-form-label"></label>
    <div class="col-md-10">
        <div class="custom-control custom-radio custom-control-inline">
            <input type="radio" class="custom-control-input" id="staticBoy" name="gender" value="1" checked required>
            <label class="custom-control-label" for="staticBoy"></label>
        </div>
        <div class="custom-control custom-radio custom-control-inline">
            <input type="radio" class="custom-control-input" id="staticGirl" name="gender" value="0" required>
            <label class="custom-control-label" for="staticGirl"></label>
        </div>
        <small class="form-text text-muted">[] </small>
    </div>
</div>

when there is no value in old, you need to compare it with the value in $user- > gender. Select!
solve.

Mar.03,2021

<div class="form-group row mb-4">
    <label for="staticPhone" class="col-md-2 col-form-label"></label>
    <div class="col-md-10">
        <input type="text" name="phone" class="form-control" id="staticPhone" value="{{ old('phone') ? old('phone') : $user->phone }}" placeholder="">
        <small class="form-text text-muted">[] </small>
    </div>
</div>

<div class="form-group row mb-4">
    <label class="col-md-2 col-form-label"></label>
    <div class="col-md-10">
        <div class="custom-control custom-radio custom-control-inline">
            <input type="radio" class="custom-control-input" id="staticBoy" name="gender" value="1" required {{ old('gender') != ''?(old('gender')=='1'?'checked':''):($user->gender == '1'?'checked':'') }}>
            <label class="custom-control-label" for="staticBoy"></label>
        </div>
        <div class="custom-control custom-radio custom-control-inline">
            <input type="radio" class="custom-control-input" id="staticGirl" name="gender" value="0" required {{ old('gender') != ''?(old('gender')=='0'?'checked':''):($user->gender == '0'?'checked':'')  }}>
            <label class="custom-control-label" for="staticGirl"></label>
        </div>
        <small class="form-text text-muted">[] </small>
    </div>
</div>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b390cf-2c177.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b390cf-2c177.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?