@php if ( Ui::keyset($attributes, 'layout') == null || (Ui::keyset($attributes, 'layout') != null && $attributes['layout'] == 'h') ) { $horizental = true; $row = ' row'; $labelClass = 'col-2 col-form-label'; } else { $horizental = false; $row = ''; $labelClass = 'col-form-label'; } $dec = json_decode($value, true); if (is_array($dec)) { $value = $dec; } if (is_string($value)) { $value = explode(',', $value); } if (isset($attributes['enable_insert']) && $attributes['enable_insert']) { $enable_insert = $attributes['enable_insert']; } else { $enable_insert = false; } if (isset($attributes['modelName'])) { if ( auth() ->user() ->can('insert_' . strtolower($attributes['modelName'])) ) { if ($enable_insert) { $parentModelName = $attributes['modelName']; $x = '\\App\\Models\\' . $parentModelName; $parentModel = new $x(); $parentFields = \App\Helpers\Form::getModalFormFields($parentModel); } } } if (isset($attributes['required']) && $attributes['required'] === true) { $labelClass .= ' required'; } @endphp
{{ Form::label($name, Ui::prettify(__('ui.' . $name)), ['class' => $labelClass]) }} @if ($horizental)
@endif
@if (isset($parentModelName) && isset($parentFields) && $enable_insert == true) @can('insert_' . Str::lower($parentModelName)) {{ Form::select($name . '[]', $list, $value, array_merge(['class' => 'form-select rounded-end-0', 'data-control' => 'select2', 'multiple' => 'multiple', 'tags' => $enable_insert??false], $attributes)) }} @endcan @else {{ Form::select($name . '[]', $list, $value, array_merge(['class' => 'form-select', 'data-control' => 'select2', 'multiple' => 'multiple', 'tags' => $enable_insert??false], $attributes)) }} @endif
@if ($horizental)
@endif
@if (isset($parentModelName) && isset($parentFields) && $enable_insert == true) @can('insert_' . Str::lower($parentModelName)) @push('script') @php $parent_validation_aliases = []; if (isset($parentModel->validation_rules) && is_array($parentModel->validation_rules)) { $parent_validation_rules = $parentModel->validation_rules; $genericController = new \App\Http\Controllers\Admin\GenericController(); $parent_validation_aliases = $genericController->get_validation_aliases($parent_validation_rules); } else { $parent_validation_rules = []; } $parent_validator = JsValidator::make($parent_validation_rules, [], $parent_validation_aliases); @endphp @if (isset($parent_validator)) {!! $parent_validator->selector('#form' . $name . 'ajax') !!} @endif @endpush @endcan @endif