@php /** * Safe getter that works for arrays/objects and tries multiple aliases. * Returns null if all are empty. */ $get = function ($item, $aliases) { foreach ((array) $aliases as $key) { // data_get handles arrays, objects, and dot-notation $val = data_get($item, $key); if ($val !== null && $val !== '') return $val; } return null; }; $fmt = function ($v, $dash = '—') { return $v !== null && $v !== '' ? $v : $dash; }; // Prefer $rows, but fall back to other common keys the controller might send $items = $rows ?? $drivers ?? $employees ?? $list ?? []; // Normalize to iterable if (!is_iterable($items)) { $items = []; } // Logo (support multiple aliases from controller) $brandLogo = $logoUrl ?? ($logo_url ?? ($company_logo ?? ($brand_logo ?? null))); // Contractor/company name $contractorName = data_get($contractor ?? null, 'company_name') ?: '—'; @endphp
@if(!empty($brandLogo)) {{ config('app.name') }} @endif {{ config('app.name') }}

Approved Drivers

Contractor: {{ $contractorName }}

@foreach ($items as $r) @php // Media (prefer exactly what the Driver Pass uses) $photo = $get($r, ['photo_url','photo','image_url','image','photoUrl','imageUrl','avatarUrl']); $qr = $get($r, ['qr_url','qrUrl','qr_code_url','qrCodeUrl']); $link = $get($r, ['link','driver_pass_url','driverPassUrl','open_pass_url']); // Identity & meta $name = $get($r, ['name','full_name']); $role = $get($r, ['role']); $dept = $get($r, ['department']); $ic = $get($r, ['ic_no','cnic','nic','id_no','national_id']); $email = $get($r, ['email']); $phone = $get($r, ['phone','phone_no']); // Vehicle & license with all common aliases $vehicle = $get($r, ['vehicle_no','vehicle_number','vehicleRegistration','vehicle_registration']); $license = $get($r, ['license_no','licenseNo']); $licenseExpiry = $get($r, ['license_expiry','licenseExpiry']); // Pass / QR validity (correct field) $qrValidity = $get($r, ['qr_validity','qrValidity','expires_at_human']); // fallback to human expiry $expiry = $get($r, ['expiry','expires_at_date']); // date string @endphp
@if($photo) Photo @else
@endif
{{ $fmt($name) }}
{{ $fmt($role) }} @if($dept) • {{ $dept }} @endif
IC / CNIC {{ $fmt($ic) }}
Email @if($email) {{ $email }} @else — @endif
Phone {{ $fmt($phone) }}
Vehicle # {{ $fmt($vehicle) }}
License Expiry {{ $fmt($licenseExpiry) }}
Pass Expiry {{ $fmt($expiry) }}
@if($qr) QR @else
@endif
@if($link) Open Driver Pass @else Link unavailable @endif
@endforeach

Share these public links or QR images with your drivers as needed. The “Open Driver Pass” link does not require a password and is secured by the embedded token.

© {{ date('Y') }} {{ config('app.name') }} — All rights reserved.