How to Show Old Value of Checkbox in Laravel
In this lesson, we will see how to show the old value of the checkbox in Laravel, sometimes when working on a form that has a checkbox and you submit the form if there are validation errors you want to keep the old value of the checkbox, so let's see how we can do that.
Keep the old value of the checkbox
So to show the old value of the checkbox after submitting the form use the code below:
div class="col-sm-3">
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" name="best_seller" class="form-check-input shadow-none" @checked(old('best_seller')) value="1">
Best seller
<i class="input-helper"></i></label>
</div>
</div>