Did u tried something like this ? are u using alpinejs or javascript ?
<input type="checkbox" wire:model="list.{{$index}}.selected" @if(!empty($list[$index]['selected']) && $list[$index]['selected'] == true ) checked @endif>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How to bind an array of objects to checkboxes in Laravel Livewire:
The array looks like this:
[{"name":"A","selected":true}, {"name":"B","selected":true}]
My view blade:
@foreach($list as $index => $d)
<input type="checkbox" wire:model="list.{{$index}}.selected" @if($d->selected) checked @endif>
The problem is when the checkbox is selected or unselected the array is not updated, how to solve this?
Get answer from Livewire maintainer on github discussion need to use wire.model.live instead of wire.model.
Please or to participate in this conversation.