Hi,
I have a form with a checkbox
<input type="checkbox" name="is_deletion_required" id="is_deletion_required" class="form-checkbox rounded-md" value="1" @if(old('is_deletion_required',$computer->is_deletion_required)=="1") checked @endif />
And an UpdateComputerRequest
class UpdateComputerRequest extends FormRequest
{
public function rules()
{
return [
'donor' => ['nullable', 'string' ],
'email' => ['nullable', 'email' ],
'model' => ['nullable', 'string' ],
'comment' => [ 'nullable' ],
'is_deletion_required' => [ 'boolean' ],
'needs_donation_receipt' => [ 'nullable', 'boolean' ],
'has_webcam' => [ 'nullable', 'boolean' ],
'required_equipment' => ['nullable', 'string' ],
];
}
public function authorize()
{
return true;
//return Gate::allows('task_access');
}
}
But if I open the form for an entry which was checked before and submit the form with an unchecked checkbox this information is not stored in the database. It remains checked on the page reload.
What am I doing wrong?