Files
ladill-meet/app/Support/EventsSourceLink.php
T
isaaccladandCursor 34d0a9c504
Deploy Ladill Meet / deploy (push) Successful in 1m26s
Route webinar and conference registration through Ladill Events.
Add Events linking UI and service client, remove Meet-native registration and invitation flows for these room types, and redirect attendees to Events registration when joining.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 07:38:50 +00:00

103 lines
2.7 KiB
PHP

<?php
namespace App\Support;
use App\Models\Room;
class EventsSourceLink
{
public static function isLinked(Room $room): bool
{
$source = (array) ($room->source ?? []);
return ($source['app'] ?? '') === 'events' && (int) ($source['event_id'] ?? 0) > 0;
}
public static function eventId(Room $room): ?int
{
if (! self::isLinked($room)) {
return null;
}
return (int) ((array) ($room->source ?? []))['event_id'];
}
public static function baseUrl(): string
{
return rtrim((string) config('meet.events_app_url', 'https://events.ladill.com'), '/');
}
public static function eventAdminUrl(Room $room): ?string
{
$eventId = self::eventId($room);
return $eventId ? self::baseUrl().'/events/'.$eventId.'/attendees' : null;
}
public static function eventEditUrl(Room $room): ?string
{
$eventId = self::eventId($room);
return $eventId ? self::baseUrl().'/events/'.$eventId : null;
}
public static function eventRegistrationUrl(Room $room): ?string
{
$source = (array) ($room->source ?? []);
$stored = trim((string) ($source['registration_url'] ?? ''));
if ($stored !== '') {
return $stored;
}
$eventId = self::eventId($room);
return $eventId ? self::baseUrl().'/q/'.($source['short_code'] ?? '') : null;
}
public static function eventQrUrl(Room $room): ?string
{
$eventId = self::eventId($room);
return $eventId ? self::baseUrl().'/events/'.$eventId.'/download/png' : null;
}
public static function eventCommsUrl(Room $room): ?string
{
$eventId = self::eventId($room);
return $eventId ? self::baseUrl().'/events/'.$eventId.'/attendees/comms-preview' : null;
}
public static function eventBadgesUrl(Room $room): ?string
{
$eventId = self::eventId($room);
return $eventId ? self::baseUrl().'/events/'.$eventId.'/badges' : null;
}
/** @return array<string, string|null> */
public static function urls(Room $room): array
{
return [
'admin' => self::eventAdminUrl($room),
'edit' => self::eventEditUrl($room),
'registration' => self::eventRegistrationUrl($room),
'qr' => self::eventQrUrl($room),
'comms' => self::eventCommsUrl($room),
'badges' => self::eventBadgesUrl($room),
];
}
public static function eventTitle(Room $room): ?string
{
if (! self::isLinked($room)) {
return null;
}
$title = trim((string) (((array) ($room->source ?? []))['event_title'] ?? ''));
return $title !== '' ? $title : null;
}
}