@php if (!isset($field['options'])) { if(isset($field['sorting'])){ $options = $field['model']::orderBy($field['sorting'])->get(); } else{ $options = $field['model']::all(); } } else { $options = call_user_func($field['options'], $field['model']); } $display_value = old($field['name']) ?? []; $key_name = ($field['key_name'])?? $options->first()->getKeyName(); if (empty($display_value) && $field['value']->isNotEmpty()) { $display_value = []; foreach ($field['value'] as $value) { $display_value[] = [ 'index' => $value[$key_name], 'value' => $value['pivot'][$field['pivot_value']] ?? $value[$field['pivot_value']] ?? "" ]; } } else if (empty($display_value)) { $display_value = [ [ 'index' => $field['default'] ?? -1, 'value' => "" ] ]; } @endphp
{!! $field['hint'] !!}
@endif