@php // Supports dotted keys ("sector.name") so a column can reach a relation // without every module writing its own accessor. $value = data_get($record, $key); // Enum-cast columns arrive as objects. Prefer the enum's own label where it // has one, so a table reads "Choose one" rather than "select". if ($value instanceof BackedEnum) { $value = method_exists($value, 'label') ? $value->label() : $value->value; } @endphp @switch($column['type']) @case('image') @break @case('boolean') @if ($value) Yes @else @endif @break @case('status') $value, 'bg-surface-muted text-text-muted' => ! $value, ])>{{ $value ? 'Published' : 'Draft' }} @break @case('badge') @if (filled($value)) {{ Str::headline((string) $value) }} @else @endif @break @case('date') {{ $value ? \Illuminate\Support\Carbon::parse($value)->format('d M Y') : '—' }} @break @default {{ filled($value) ? $value : '—' }} @endswitch