Files
ladill-events/app/Services/Events/EventEmailService.php
T
isaaccladandCursor fec24da7bd
Deploy Ladill Events / deploy (push) Successful in 47s
Add speaker invitations with portal page and programme host picker.
Speakers require email, get a personal holding page with programme and stage links, auto-invites when programme hosts are saved, and manual send for events without a schedule; also fix wallet copy on event create and anchor attendee comms.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 15:48:32 +00:00

112 lines
3.1 KiB
PHP

<?php
namespace App\Services\Events;
use App\Services\Billing\PlatformEmailClient;
use Illuminate\Support\Facades\View;
class EventEmailService
{
public function __construct(private readonly PlatformEmailClient $platform) {}
public function sendProgrammeShare(
string $ownerPublicId,
string $to,
string $eventName,
string $programmeUrl,
?string $attendeeName = null,
): bool {
return $this->send(
$ownerPublicId,
$to,
'Programme for '.$eventName,
'mail.notifications.event-programme',
compact('eventName', 'programmeUrl', 'attendeeName'),
);
}
public function sendJoinLink(
string $ownerPublicId,
string $to,
string $eventName,
string $joinUrl,
?string $attendeeName = null,
): bool {
return $this->send(
$ownerPublicId,
$to,
'Join '.$eventName,
'mail.notifications.event-join',
compact('eventName', 'joinUrl', 'attendeeName'),
);
}
public function sendJoinAndProgramme(
string $ownerPublicId,
string $to,
string $eventName,
string $joinUrl,
string $programmeUrl,
?string $attendeeName = null,
): bool {
return $this->send(
$ownerPublicId,
$to,
$eventName.' — programme & join link',
'mail.notifications.event-join-programme',
compact('eventName', 'joinUrl', 'programmeUrl', 'attendeeName'),
);
}
public function sendRegistrationConfirmation(
string $ownerPublicId,
string $to,
string $eventName,
string $badgeCode,
?string $joinUrl = null,
?string $attendeeName = null,
): bool {
return $this->send(
$ownerPublicId,
$to,
'Registration confirmed — '.$eventName,
'mail.notifications.event-registration-confirmed',
compact('eventName', 'badgeCode', 'joinUrl', 'attendeeName'),
);
}
public function sendSpeakerInvite(
string $ownerPublicId,
string $to,
string $eventName,
string $portalUrl,
?string $speakerName = null,
): bool {
return $this->send(
$ownerPublicId,
$to,
'Speaker invitation — '.$eventName,
'mail.notifications.event-speaker-invite',
[
'eventName' => $eventName,
'portalUrl' => $portalUrl,
'speakerName' => $speakerName,
],
);
}
/** @param array<string, mixed> $viewData */
private function send(string $ownerPublicId, string $to, string $subject, string $view, array $viewData): bool
{
$html = View::make($view, $viewData)->render();
return $this->platform->send(
$ownerPublicId,
$to,
$subject,
$html,
strip_tags(str_replace(['<br>', '<br/>', '<br />'], "\n", $html)),
);
}
}