@props([
    'group' => [
        'class' => null,
    ],
    'fieldname' => null,
    'label' => null,
    'options' => [],
    'checked' => null,
])

@php
    $attributes = $attributes
    ->merge([
    ])
    ->class([
        'checkbox__input',
    ]);

    $checked = (array) json_decode($checked, TRUE);
@endphp

<x-bs-form.group class="{{ $group['class'] }}">
    {{ $label }}
    @foreach($options AS $key => $option)
    <div class="checkbox">
        <input type="checkbox" {{ $attributes }} name="{{ $fieldname }}[]" value="{{ $key }}" {{ (in_array($key, $checked)) ? 'checked' : '' }} />
        <x-bs-form.label 
            :label=$option
        />
    </div>
    @endforeach
</x-bs-form.group>