@php /** @var string $type life|mortgage|health */ /** @var array $columns */ /** @var \Illuminate\Support\Collection|\Illuminate\Pagination\LengthAwarePaginator $rows */ $titleMap = ['life' => 'Life', 'mortgage' => 'Mortgage Protection', 'health' => 'Health']; $title = $titleMap[$type] ?? ucfirst($type); // Choose a compact set of columns to display $preferred = [ 'id', 'purchase_date', 'full_name', 'first_name', 'last_name', 'email', 'phone_number', 'city', 'state', 'zipcode', 'status', 'insurance_type', ]; $displayColumns = collect($columns ?? []) ->intersect($preferred) ->values() ->all(); if (empty($displayColumns)) { $displayColumns = array_slice($columns ?? [], 0, 8); } $hasRows = $rows instanceof \Illuminate\Contracts\Support\Htmlable || $rows instanceof \Illuminate\Pagination\LengthAwarePaginator ? $rows->count() > 0 : is_iterable($rows) && count($rows) > 0; // Route used for export (ensure this route name exists in routes/web.php) $exportUrl = route('agent.leads.purchased.export', ['type' => $type]); @endphp
{{ \Illuminate\Support\Str::of($col)->snake()->replace('_', ' ')->title() }} | @endforeach
---|
@php $val = data_get($row, $col); @endphp @if ($val instanceof \Carbon\CarbonInterface) {{ $val->format('Y-m-d') }} @else {{ $val }} @endif | @endforeach