If a checkbox is not checked nothing is passed.
Edit form with checkboxes
I have a problem with the correct operation of the checkbox control when editing data.
If I use a code:
<input type="checkbox" class="form-checkbox" name="select_tags.{{ $tag->tag_id }}[]" wire:dirty="select_tags.{{ $tag->tag_id }}" value="{{ $tag->tag_id }}" {{ in_array($tag->tag_id, $cms_tags->pluck('tag_id')->toArray()) ? ' checked' : '' }}>
On the website I can see which checkbox-es have been selected earlier. (Checkboxes are marked) but when I change and save my array with the selected tags (checkboxes) is empty.
If I use a code:
<input type="checkbox" class="form-checkbox" name="select_tags.{{ $tag->tag_id }}[]" wire:model="select_tags.{{ $tag->tag_id }}" value="{{ $tag->tag_id }}" {{ in_array($tag->tag_id, $cms_tags->pluck('tag_id')->toArray()) ? ' checked' : '' }}>
I do not see on the website which boxes have been selected earlier. (Checkboxes are not marked) but when I change and save my array with the selected tags (checkboxes) is not empty and contains the id of the selected tags.
How to make the selection of checkboxes and their saving in the database work properly
Please or to participate in this conversation.