1 year ago

problem in use switchery

Posted 1 year ago by mDelshad

i'm use switchery for checkbox...But only one of the checkboxes takes a stylist. The rest of the checkboxes have a typical style



import Switchery from './switchery.min'

var elems ='.switch-input'));

elems.forEach(function(html) {
  var switchery = new Switchery(html);

and blade :

                                                @foreach($roles as $role)
                                                    <div class="card">
                                                        <div class="card-header">
                                                            <div class="checkbox d-flex align-items-center">
                                                                {{ html()->label(
                                                                        html()->checkbox('roles[]', in_array($role->name, $userRoles), $role->name)
                                                                        . '<span class="switch-slider" data-checked="on" data-unchecked="off"></span>')
                                                                    ->class('switch switch-label switch-pill switch-primary mr-2')
                                                                    ->for('role-'.$role->id) }}
                                                                {{ html()->label(ucwords($role->name))->for('role-'.$role->id) }}
                                                        <div class="card-body">
                                                            @if($role->id != 1)
                                                                    @foreach($role->permissions as $permission)
                                                                        <i class="fas fa-dot-circle"></i> {{ ucwords($permission->name) }}

Please sign in or create an account to participate in this conversation.