transfer->loadMissing(['files', 'qrCode', 'user']); $publicUrl = $transfer->qrCode?->shareUrl() ?? ''; return (new MailMessage()) ->subject($this->subjectLine()) ->view('mail.notifications.transfer-recipient', [ 'transfer' => $transfer, 'publicUrl' => $publicUrl, 'milestone' => $this->milestone, 'senderName' => $transfer->user?->name, 'daysRemaining' => $this->daysRemaining(), ]); } private function subjectLine(): string { return match ($this->milestone) { 'created' => $this->transfer->user?->name ? "{$this->transfer->user->name} shared files with you" : "Files shared with you: {$this->transfer->title}", 'grace' => "Download soon — {$this->transfer->title} needs payment", '1' => "Last day to download: {$this->transfer->title}", '3' => "3 days left to download: {$this->transfer->title}", '7' => "Download reminder: {$this->transfer->title}", default => "Download reminder: {$this->transfer->title}", }; } private function daysRemaining(): ?int { if (! is_numeric($this->milestone)) { return null; } return (int) $this->milestone; } }