Checkboxes in edit form

What seems to be the problem:
I have a problem with the correct operation of the checkbox control when editing data.

Steps to Reproduce:
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' : '' }}>

This checkbox shows what items I have selected in the database ( I see on the website which items in the checkbox are checked, the checkbox is checked ), but when I change and save them, the select_tags control does not contain the data that I selected and it is normal that the change is not saved in the base.

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' : '' }}>

This checkbox does not show which items I have selected in the database ( I do not see on the website which items in the checkbox are checked, the checkbox is checked only in code I see checkbox = checked) but when I make a change and save it, the select_tags control contains the data that I selected and the change is saved in the database.

How to make both showing and saving data work.

Are you using the latest version of Livewire:
Yes

Do you have any screenshots or code examples:
No

Nobody can help?
Is it possible to do?

You could create a selected property as array:

public $selected = [];

Then I use this property in my blade files:

<x-input.checkbox wire:model="selected" value="{{ $tag->id }}"/>
<x-input.checkbox wire:model="selected" value="{{ $tag->id }}"/>

$selected then holds your IDs. value represents the ID of your tag.