mardi 9 août 2022

Validating old method in control does not work correctly with empty value

In laravel 9, breeze form I use old method in controls like :

<x-input id="text" type="text" name="text" value="" />
...
<input type="checkbox" @if (old('published') ? old('published') : $subscription->published) checked @endif

But it does not work correctly in case when in text input I leave empty text and I leave published field unchecked :

text input shows $subscription->text(If it had some content from db) and published checkbox is checked (If ($subscription->published) was checked priorly from db)

How can it be fixed ?

Thanks!




Aucun commentaire:

Enregistrer un commentaire