@php
$isList = is_array($value) && array_is_list($value);
$isRowList = $isList && $value !== [] && collect($value)->every(fn ($item) => is_array($item) && ! array_is_list($item));
@endphp
@if ($value === null || $value === [])
—
@elseif (is_bool($value))
{{ $value ? 'Yes' : 'No' }}
@elseif (is_string($value) && preg_match('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/', $value))
{{ \Carbon\Carbon::parse($value)->format('d M Y, h:i:s A') }}
@elseif (! is_array($value))
{{ $value }}
@elseif ($isRowList)
@php
$columns = collect($value)->flatMap(fn ($row) => array_keys($row))->unique()->values();
@endphp
| # |
@foreach ($columns as $column)
{{ \Illuminate\Support\Str::headline((string) $column) }} |
@endforeach
@foreach ($value as $index => $row)
| {{ $index + 1 }} |
@foreach ($columns as $column)
@include('filament.pages.astrology.partials.value', ['value' => $row[$column] ?? null]) |
@endforeach
@endforeach
@elseif ($isList && collect($value)->every(fn ($item) => ! is_array($item)))
{{ collect($value)->map(fn ($item) => is_bool($item) ? ($item ? 'Yes' : 'No') : $item)->implode(', ') }}
@else
@foreach ($value as $key => $item)
| {{ is_int($key) ? $key : \Illuminate\Support\Str::headline($key) }} |
@include('filament.pages.astrology.partials.value', ['value' => $item]) |
@endforeach
@endif