Route webinar and conference registration through Ladill Events.
Deploy Ladill Meet / deploy (push) Successful in 1m26s

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>
This commit is contained in:
isaacclad
2026-07-02 07:38:50 +00:00
co-authored by Cursor
parent 8162827957
commit 34d0a9c504
20 changed files with 595 additions and 286 deletions
@@ -0,0 +1,81 @@
<?php
namespace App\Services\Integrations;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Support\Facades\Http;
class EventsClient
{
private function client()
{
return Http::baseUrl(rtrim((string) config('meet.events_api_url'), '/'))
->withToken((string) config('meet.events_api_key'))
->acceptJson()
->asJson()
->connectTimeout(10)
->timeout(20);
}
public function isConfigured(): bool
{
return filled(config('meet.events_api_url')) && filled(config('meet.events_api_key'));
}
/**
* @return list<array<string, mixed>>
*/
public function linkableEvents(string $ownerRef): array
{
$response = $this->get('events', ['owner_ref' => $ownerRef]);
return (array) ($response['events'] ?? []);
}
/**
* @param array<string, mixed> $payload
* @return array<string, mixed>
*/
public function linkRoom(int $eventId, array $payload): array
{
$response = $this->post("events/{$eventId}/link-room", $payload);
return (array) ($response['event'] ?? []);
}
/**
* @return array<string, mixed>
*/
private function get(string $path, array $query = []): array
{
try {
$response = $this->client()->get($path, $query);
} catch (ConnectionException) {
throw new \RuntimeException('Could not reach Ladill Events.');
}
if ($response->failed()) {
throw new \RuntimeException('Events service error: '.($response->json('message') ?? $response->body()));
}
return (array) $response->json();
}
/**
* @return array<string, mixed>
*/
private function post(string $path, array $data): array
{
try {
$response = $this->client()->post($path, $data);
} catch (ConnectionException) {
throw new \RuntimeException('Could not reach Ladill Events.');
}
if ($response->failed()) {
throw new \RuntimeException('Events service error: '.($response->json('message') ?? $response->body()));
}
return (array) $response->json();
}
}
@@ -0,0 +1,63 @@
<?php
namespace App\Services\Integrations;
use App\Models\Room;
use App\Models\User;
use App\Support\EventsSourceLink;
class EventsLinkService
{
public function __construct(private readonly EventsClient $events) {}
/**
* @return list<array<string, mixed>>
*/
public function linkableEvents(User $user): array
{
if (! $this->events->isConfigured()) {
return [];
}
return $this->events->linkableEvents($user->ownerRef());
}
public function link(Room $room, User $user, int $eventId, ?string $virtualSessionId = null): Room
{
abort_unless($room->isWebinar() || $room->isConference(), 422);
$result = $this->events->linkRoom($eventId, [
'owner_ref' => $user->ownerRef(),
'meet_room_uuid' => $room->uuid,
'meet_room_type' => $room->isConference() ? 'town_hall' : 'webinar',
'join_url' => $room->joinUrl(),
'title' => $room->title,
'scheduled_at' => $room->scheduled_at?->toIso8601String(),
'duration_minutes' => $room->duration_minutes ?? 60,
'virtual_session_id' => $virtualSessionId,
]);
$room->update([
'source' => [
'app' => 'events',
'entity_type' => 'virtual_session',
'entity_id' => (string) ($result['entity_id'] ?? ''),
'event_id' => (string) $eventId,
'event_title' => (string) ($result['title'] ?? ''),
'registration_url' => (string) ($result['registration_url'] ?? ''),
'short_code' => (string) ($result['short_code'] ?? ''),
],
]);
return $room->fresh();
}
public function unlink(Room $room): Room
{
abort_unless(EventsSourceLink::isLinked($room), 422);
$room->update(['source' => null]);
return $room->fresh();
}
}