Files
ladill-transfer/app/Services/Transfer/TransferRecipientMailService.php
T
isaaccladandCursor 4b616a7f04
Deploy Ladill Transfer / deploy (push) Successful in 47s
Simplify recipient emails and add live upload progress on create.
Recipients always get the download link immediately when an email is set.
Large files upload in the background with per-file and overall progress bars.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-08 13:25:43 +00:00

36 lines
936 B
PHP

<?php
namespace App\Services\Transfer;
use App\Models\Transfer;
use App\Notifications\TransferRecipientNotification;
use Illuminate\Support\Facades\Notification;
/** Sends the immediate download-link email to transfer recipients. */
class TransferRecipientMailService
{
public function notifyRecipient(Transfer $transfer, string $milestone = 'created'): bool
{
if ($milestone !== 'created') {
return false;
}
$email = trim((string) $transfer->recipient_email);
if ($email === '') {
return false;
}
if ($transfer->recipientMilestoneSent('created')) {
return false;
}
Notification::route('mail', $email)->notify(
new TransferRecipientNotification($transfer->loadMissing(['files', 'qrCode', 'user']), 'created'),
);
$transfer->markRecipientMilestoneSent('created');
return true;
}
}