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:
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.