Deploy Ladill Events / deploy (push) Successful in 41s
Programme sync to Meet rooms, wallet-billed mass comms, webhook lifecycle updates, and registration access bridge with join-window gating on public pages. Co-authored-by: Cursor <cursoragent@cursor.com>
92 lines
2.5 KiB
PHP
92 lines
2.5 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'),
|
|
);
|
|
}
|
|
|
|
/** @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)),
|
|
);
|
|
}
|
|
}
|