@use('App\Models\License') @php /* | Requires in scope: $license (with customer, package, domain loaded). | Everything here reads the relations the controller already eager-loaded. */ $domain = $license->domain; $status = $license->effectiveStatus(); $expires = $license->expires_at; $days = $expires ? (int) round(now()->startOfDay()->diffInDays($expires->copy()->startOfDay(), false)) : null; $expiryNote = match (true) { $days === null => null, $days < 0 => 'Expired '.abs($days).' '.Str::plural('day', abs($days)).' ago', $days === 0 => 'Expires today', default => $days.' '.Str::plural('day', $days).' left', }; $expiryTone = match (true) { $days === null => 'text-slate-400 dark:text-slate-500', $days < 0 => 'text-red-600 dark:text-red-400', $days <= 30 => 'text-amber-600 dark:text-amber-400', default => 'text-emerald-600 dark:text-emerald-400', }; // label, icon, value, sub-line, sub-line tone — one list so the grid stays // uniform and a field cannot drift out of the shared markup below. $fields = [ ['Customer', 'user', $license->customer?->company_name ?? '—', $license->customer?->email, null], ['Package', 'package', $license->package?->name ?? '—', $license->duration_days ? $license->duration_days.'-day term' : 'No fixed term', null], ['Domain', 'globe', null, null, null], // rendered specially below ['Current IP', 'server', $domain?->current_ip ?? '—', null, null], ['CMS Version', 'layers', $domain?->cms_version ? 'v'.$domain->cms_version : 'Not reported', null, null], ['Activated', 'check-circle', $license->activated_at?->format('d M Y') ?? 'Not yet activated', $license->activated_at?->diffForHumans(), null], ['Expires', 'calendar', $expires?->format('d M Y') ?? 'Never', $expiryNote, $expiryTone], ['Last Verification', 'clock', $domain?->last_verification_at?->diffForHumans() ?? 'Never', $domain?->last_verification_at?->format('d M Y H:i'), null], ]; @endphp
{{-- The key is the headline: it is what gets pasted into support tickets, so it leads, monospaced, with its copy button beside it. --}}

License Key

{{ $license->license_key }}

{{-- Information grid --}}
@foreach ($fields as [$label, $icon, $value, $sub, $subTone])
{{ $label }}
@if ($label === 'Domain')
@if ($domain) {{ $domain->domain }} @else Not activated yet @endif
@else
{{ $value }}
@endif @if ($sub)
{{ $sub }}
@endif
@endforeach
@if ($license->notes)

Notes

{{ $license->notes }}

@endif