@php /** @var \App\Models\Owner $owner */ /** @var \Illuminate\Support\Carbon $fromDate */ /** @var \Illuminate\Support\Carbon $toDate */ /** @var array $totals */ /** @var int $payoutAmountCents */ /** @var array|null $previewTotals */ /** @var \Illuminate\Support\Carbon|null $previewPayoutDate */ /** @var \Illuminate\Support\Collection|null $previewJobs */ /** @var \Illuminate\Support\Collection|null $vehicles */ /** @var string $statementId */ $earnings = $totals['earnings_cents'] ?? 0; $costs = $totals['costs_cents'] ?? 0; $payouts = $totals['payouts_cents'] ?? 0; $adjustments = $totals['adjustments_cents'] ?? 0; $balance = $totals['balance_cents'] ?? 0; $fmt = fn (int $cents) => '$' . number_format($cents / 100, 2); // Normalise preview data so this view never explodes $previewTotals = $previewTotals ?? ['owner_total_cents' => 0, 'month_label' => null, 'per_vehicle_cents' => []]; $previewPayoutDate = $previewPayoutDate ?? now()->copy()->day(10); $previewJobs = isset($previewJobs) ? $previewJobs : collect(); $previewOwnerTotal = $previewTotals['owner_total_cents'] ?? 0; $previewMonthLabel = $previewTotals['month_label'] ?? $previewPayoutDate->format('F Y'); $previewPerVehicle = $previewTotals['per_vehicle_cents'] ?? []; @endphp
Hi {{ $owner->legal_name ?? $owner->name }},
Please find attached your owner statement for {{ $fromDate->toFormattedDateString() }} to {{ $toDate->toFormattedDateString() }}.
Earnings (your share) {{ $fmt($earnings) }}
Adjustments {{ $fmt($adjustments) }}
Costs {{ $fmt($costs) }}
Payouts {{ $fmt($payouts) }}
Balance {{ $fmt($balance) }}
We’ve paid {{ $fmt($payoutAmountCents) }} to your nominated bank account today.
@endif @if ($previewOwnerTotal > 0)
Looking ahead – next payout
Estimated owner share for bookings ending in
{{ $previewMonthLabel }} is
{{ $fmt($previewOwnerTotal) }}.
These are expected to be paid on
{{ $previewPayoutDate->toFormattedDateString() }},
according to our payout schedule (10th of each month for the previous month’s completed bookings).
By vehicle:
@foreach ($previewPerVehicle as $vehicleName => $ownerCents)
• {{ $vehicleName }} – {{ $fmt($ownerCents) }}
@endforeach
Your vehicle is booked on:
@foreach ($previewJobs as $job)
@php
$start = \Carbon\Carbon::parse($job->start_at)->toFormattedDateString();
$end = \Carbon\Carbon::parse($job->end_at)->toFormattedDateString();
@endphp
• {{ $job->vehicle?->name }}:
{{ $start }} – {{ $end }}
@endforeach
If you have any questions about this statement, just reply to this email and we’ll be happy to help.
Thanks,
Dream Drives