protonemedia/laravel-form-components

Checkbox problems

ArtMin96 opened this issue · 1 comments

I have a problem with checkboxes checked.

In this version, the checkboxes simply disappear.

<x-form-checkbox
    name="permissions[]"
    :show-errors="false"
    value="{{ $permission->id }}"
    label="{{ $permission->description }}"
    @if($role->permissions->contains($permission->id))
        default
    @endif
/>

This also does nothing.

<x-form-checkbox
    name="permissions[]"
    :show-errors="false"
    value="{{ $permission->id }}"
    label="{{ $permission->description }}"
    :bind="true"
/>

You should use give the boolean value to the default attribute:

:default="$role->permissions->contains($permission->id)"