Deploy Ladill Events / deploy (push) Successful in 47s
Add badge verification API, preserve meet_return through registration and payment, and link confirmation back to Meet with badge auto-login. Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1022 B
PHP
38 lines
1022 B
PHP
<?php
|
|
|
|
namespace App\Services\Meet;
|
|
|
|
use App\Models\QrCode;
|
|
use App\Models\QrEventRegistration;
|
|
|
|
class EventRegistrationVerifyService
|
|
{
|
|
/** @return array<string, mixed>|null */
|
|
public function verifyBadge(QrCode $event, string $badgeCode): ?array
|
|
{
|
|
abort_unless($event->type === QrCode::TYPE_EVENT, 404);
|
|
|
|
$normalized = strtoupper(trim($badgeCode));
|
|
if ($normalized === '') {
|
|
return null;
|
|
}
|
|
|
|
$registration = QrEventRegistration::query()
|
|
->where('qr_code_id', $event->id)
|
|
->where('badge_code', $normalized)
|
|
->where('status', QrEventRegistration::STATUS_CONFIRMED)
|
|
->first();
|
|
|
|
if (! $registration) {
|
|
return null;
|
|
}
|
|
|
|
return [
|
|
'attendee_name' => $registration->attendee_name,
|
|
'attendee_email' => $registration->attendee_email,
|
|
'badge_code' => $registration->badge_code,
|
|
'tier_name' => $registration->tier_name,
|
|
];
|
|
}
|
|
}
|