{{-- Thanks to Erwan Pianezza - https://github.com/breizhwave--}} {{-- This field assumes you have a nested set Eloquent model, using: --}} {{-- 1. children() as a properly defined relationship --}} {{-- 2. depth, lft attributes --}} @php $current_value = old($field['name']) ? old($field['name']) : (isset($field['value']) ? $field['value'] : (isset($field['default']) ? $field['default'] : '' )); if (!function_exists('echoSelect2NestedEntry')) { function echoSelect2NestedEntry($entry, $field, $current_value) { if ($current_value == $entry->getKey()) { $selected = ' selected '; } else { $selected = ''; } echo '"; } } if (!function_exists('echoSelect2NestedChildren')) { function echoSelect2NestedChildren($entity, $field, $current_value) { foreach ($entity->children()->get() as $entry) { echoSelect2NestedEntry($entry, $field, $current_value); echoSelect2NestedChildren($entry, $field, $current_value); } } } $entity_model = $crud->getRelationModel($field['entity'], -1); $field['allows_null'] = $field['allows_null'] ?? $entity_model::isColumnNullable($field['name']); @endphp @include('crud::fields.inc.wrapper_start') @include('crud::fields.inc.translatable_icon') {{-- 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 CSS - will be loaded in the after_styles section --}} @push('crud_fields_styles') @endpush {{-- FIELD JS - will be loaded in the after_scripts section --}} @push('crud_fields_scripts') @if (app()->getLocale() !== 'en') @endif @endpush @endif {{-- End of Extra CSS and JS --}} {{-- ########################################## --}}