Custom field: bind array data

I created a custom field and this custom field renders mutliple Filament Checkboxes:
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
    <div x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }">
        <!-- Interact with the `state` property in Alpine.js -->
        <h1>Changing permissions for {{ $user()?->username}}</h1>
        @foreach ($projectPermissions() as $permission)
        <label>
            <x-filament::input.checkbox x-model="state" />
        
            <span>
            {{ $permission->name }}
            {{ $permission->destination->name }}
            </span>
        </label>
        @endforeach
    </div>

</x-dynamic-component>

As you can see I bind the input to the state. The problem is that this binds every Checkbox to the state and this results in every checkbox using the same state (so only one true/false value for all checkboxes). How can I bind each checkbox to an array in the state?
Was this page helpful?