@php $model = new $field['model']; $key_attribute = $model->getKeyName(); $identifiable_attribute = $field['attribute']; // calculate the checklist options if (!isset($field['options'])) { // $field['options'] = $field['model']::orderBy('scope', 'asc')->pluck($identifiable_attribute, $key_attribute)->toArray(); $field['options'] = $field['model']::orderBy('scope', 'asc')->get()->toArray(); } else { $field['options'] = call_user_func($field['options'], $field['model']::query()); } // calculate the value of the hidden input $field['value'] = old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? []; if ($field['value'] instanceof Illuminate\Database\Eloquent\Collection) { $field['value'] = $field['value']->pluck($key_attribute)->toArray(); } elseif (is_string($field['value'])){ $field['value'] = json_decode($field['value']); } // define the init-function on the wrapper $field['wrapper']['data-init-function'] = $field['wrapper']['data-init-function'] ?? 'bpFieldInitChecklist'; @endphp @include('crud::fields.inc.wrapper_start') @include('crud::fields.inc.translatable_icon')
@php $i = 1; $scope= array(); @endphp @foreach ($field['options'] as $key => $option) @if ($option['scope'] != end($scope)) @php array_push($scope, $option['scope']); @endphp
{{ $option['scope'] ? $option['scope'] : 'Configuration' }}
@endif
@php $i++; @endphp @endforeach
{{-- HINT --}} @if (isset($field['hint']))

{!! $field['hint'] !!}

@endif @include('crud::fields.inc.wrapper_end') {{-- ########################################## --}} {{-- Extra CSS and JS for this particular field --}} {{-- If a field type is shown multiple times on a form, the CSS and JS will only be loaded once --}} @if ($crud->fieldTypeNotLoaded($field)) @php $crud->markFieldTypeAsLoaded($field); @endphp {{-- FIELD JS - will be loaded in the after_scripts section --}} @push('crud_fields_scripts') @endpush @endif {{-- End of Extra CSS and JS --}} {{-- ########################################## --}}