Files
ladill-events/app/Http/Controllers/Api/V1/ServiceMeetController.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

92 lines
3.3 KiB
PHP

<?php
namespace App\Http\Controllers\Api\V1;
use App\Http\Controllers\Controller;
use App\Models\QrCode;
use App\Models\User;
use App\Services\Meet\EventMeetRoomLinkService;
use App\Services\Meet\EventRegistrationVerifyService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ServiceMeetController extends Controller
{
public function __construct(private readonly EventMeetRoomLinkService $links) {}
public function index(Request $request): JsonResponse
{
$validated = $request->validate([
'owner_ref' => ['required', 'string', 'max:64'],
]);
$owner = User::query()->where('public_id', $validated['owner_ref'])->firstOrFail();
return response()->json([
'events' => $this->links->linkableEvents($owner),
]);
}
public function linkRoom(Request $request, QrCode $event): JsonResponse
{
$validated = $request->validate([
'owner_ref' => ['required', 'string', 'max:64'],
'meet_room_uuid' => ['required', 'string', 'max:64'],
'meet_room_type' => ['required', 'string', 'in:town_hall,webinar'],
'join_url' => ['nullable', 'string', 'max:2048'],
'title' => ['nullable', 'string', 'max:255'],
'scheduled_at' => ['nullable', 'date'],
'duration_minutes' => ['nullable', 'integer', 'min:15', 'max:480'],
'virtual_session_id' => ['nullable', 'string', 'max:64'],
]);
$owner = User::query()->where('public_id', $validated['owner_ref'])->firstOrFail();
abort_unless($event->type === QrCode::TYPE_EVENT, 404);
$result = $this->links->linkRoom($owner, $event, $validated);
return response()->json(['event' => $result]);
}
public function verifyRegistration(Request $request, QrCode $event): JsonResponse
{
$validated = $request->validate([
'owner_ref' => ['required', 'string', 'max:64'],
'badge_code' => ['required', 'string', 'max:16'],
]);
$owner = User::query()->where('public_id', $validated['owner_ref'])->firstOrFail();
abort_unless($event->user_id === $owner->id, 403);
abort_unless($event->type === QrCode::TYPE_EVENT, 404);
$result = app(EventRegistrationVerifyService::class)->verifyBadge($event, $validated['badge_code']);
if (! $result) {
return response()->json(['message' => 'Badge not found.'], 404);
}
return response()->json(['registration' => $result]);
}
public function verifySpeaker(Request $request, QrCode $event): JsonResponse
{
$validated = $request->validate([
'owner_ref' => ['required', 'string', 'max:64'],
'speaker_token' => ['required', 'string', 'max:128'],
]);
$owner = User::query()->where('public_id', $validated['owner_ref'])->firstOrFail();
abort_unless($event->user_id === $owner->id, 403);
abort_unless($event->type === QrCode::TYPE_EVENT, 404);
$result = app(\App\Services\Events\EventSpeakerInviteService::class)
->verifyToken($event, $validated['speaker_token']);
if (! $result) {
return response()->json(['message' => 'Speaker invite not found.'], 404);
}
return response()->json(['speaker' => $result]);
}
}