@extends('layouts.admin')
@section('title', $res::$plural)
@section('content')
@php
$cols = $res::columns();
$linkCol = collect($cols)->first(fn ($c) => ! in_array($c['type'] ?? 'text', ['image', 'bool']))['name'] ?? null;
@endphp
{{ $res::$plural }}
@if($res::$hint)
{{ $res::$hint }}
@endif
+ Add {{ strtolower($res::$label) }}
@if($items->isEmpty())
Nothing here yet. Add the first {{ strtolower($res::$label) }}.
@else
@foreach($cols as $col)| {{ $col['label'] }} | @endforeach |
@foreach($items as $item)
@foreach($cols as $col)
@php $val = data_get($item, $col['name']); $type = $col['type'] ?? 'text'; @endphp
@switch($type)
@case('image')
@if($val) @endif
@break
@case('bool')
{{ $val ? 'Yes' : 'No' }}
@break
@case('money')
{{ $val !== null ? trim(($col['prefix'] ?? '').' '.number_format($val)) : '' }}
@break
@case('date')
{{ $val?->format('j M Y') }}
@break
@case('badge')
{{ $val }}
@break
@default
@if($col['name'] === $linkCol){{ $val }}@else{{ $val }}@endif
@endswitch
|
@endforeach
Edit
|
@endforeach
@endif
@endsection