Files
ladill-meet/app/Support/EventsSourceLink.php
T
isaaccladandCursor d648f6c862
Deploy Ladill Meet / deploy (push) Successful in 33s
Add speak access for webinar/conference attendees and fix Events linking UX.
Let attendees request host-granted microphone access with LiveKit reconnect,
participant panel controls, and toolbar UI that only shows mic when allowed.
Fix Events create URL, surface API key setup guidance, and align the Webinars
sidebar icon with other nav items using currentColor strokes.

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

113 lines
3.0 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 isApiConfigured(): bool
{
return filled(config('meet.events_api_url')) && filled(config('meet.events_api_key'));
}
public static function createEventUrl(?Room $room = null): string
{
return self::baseUrl().'/events/create';
}
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;
}
}