Reputation: 69
The checkbox does not take the value from the database. Help please. Thank you.
edit.blade.php
<div class="form-group">
<input type="checkbox" class="" id="onloan"
value="{{ $item->onloan }}">
<label for="onloan">On Loan</label>
</div>
Upvotes: 0
Views: 92
Reputation: 1
You have to use checked
property to check of input
checkbox element.
<input type="checkbox" class="" id="onloan" value="1" {{ $item->onloan == 1 ? 'checked' : '' }}>
Upvotes: 2
Reputation: 306
<div class="form-group">
<input type="checkbox" class="" id="onloan" value="{{ $item->onloan }}" {{$item->onloan == 1 ? 'checked' : ''}}>
<label for="onloan">On Loan</label>
</div>
Upvotes: 0