Add speaker invitations with portal page and programme host picker.
Deploy Ladill Events / deploy (push) Successful in 47s
Deploy Ladill Events / deploy (push) Successful in 47s
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>
This commit is contained in:
@@ -67,4 +67,25 @@ class ServiceMeetController extends Controller
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Events;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\QrCode;
|
||||
use App\Services\Events\EventSpeakerInviteService;
|
||||
use App\Services\Events\EventSpeakerService;
|
||||
use App\Services\Qr\QrCodeManagerService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
@@ -14,6 +15,7 @@ class SpeakerController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EventSpeakerService $speakers,
|
||||
private readonly EventSpeakerInviteService $invites,
|
||||
private readonly QrCodeManagerService $manager,
|
||||
) {}
|
||||
|
||||
@@ -40,11 +42,16 @@ class SpeakerController extends Controller
|
||||
$this->authorize('view', $event);
|
||||
abort_unless($event->type === QrCode::TYPE_EVENT, 404);
|
||||
|
||||
$roster = $this->invites->rosterWithInviteState($event);
|
||||
|
||||
return view('events.speakers', [
|
||||
'qrCode' => $event,
|
||||
'roster' => (array) ($event->content()['speakers'] ?? []),
|
||||
'roster' => $roster,
|
||||
'programmeAssignments' => $this->speakers->programmeAssignments($event),
|
||||
'programme' => $this->speakers->linkedProgramme($event),
|
||||
'canManualInvite' => collect($roster)->mapWithKeys(fn ($speaker) => [
|
||||
$speaker['email'] => $this->invites->canSendManualInvite($event, $speaker),
|
||||
])->all(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -56,17 +63,39 @@ class SpeakerController extends Controller
|
||||
$validated = $request->validate([
|
||||
'speakers' => ['nullable', 'array'],
|
||||
'speakers.*.name' => ['nullable', 'string', 'max:120'],
|
||||
'speakers.*.email' => ['nullable', 'email', 'max:190'],
|
||||
'speakers.*.email' => ['required_with:speakers.*.name', 'email', 'max:190'],
|
||||
'speakers.*.role' => ['nullable', 'string', 'max:80'],
|
||||
'speakers.*.bio' => ['nullable', 'string', 'max:500'],
|
||||
]);
|
||||
|
||||
$this->manager->update($event, [
|
||||
'speakers' => $validated['speakers'] ?? [],
|
||||
]);
|
||||
try {
|
||||
$this->manager->update($event, [
|
||||
'speakers' => $validated['speakers'] ?? [],
|
||||
]);
|
||||
} catch (\RuntimeException $e) {
|
||||
return back()->withInput()->with('error', $e->getMessage());
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('speakers.show', $event)
|
||||
->with('success', 'Speaker roster saved.');
|
||||
}
|
||||
|
||||
public function sendInvite(Request $request, QrCode $event): RedirectResponse
|
||||
{
|
||||
$this->authorize('update', $event);
|
||||
abort_unless($event->type === QrCode::TYPE_EVENT, 404);
|
||||
|
||||
$validated = $request->validate([
|
||||
'email' => ['required', 'email', 'max:190'],
|
||||
]);
|
||||
|
||||
$sent = $this->invites->sendManualInvite($event, $event->user, $validated['email']);
|
||||
|
||||
if (! $sent) {
|
||||
return back()->with('error', 'Could not send invitation. Check the email address or whether this speaker was already invited from the programme.');
|
||||
}
|
||||
|
||||
return back()->with('success', 'Speaker invitation sent.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Events;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Events\EventProgrammeService;
|
||||
use App\Services\Events\EventSpeakerInviteService;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class SpeakerPortalController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EventSpeakerInviteService $invites,
|
||||
private readonly EventProgrammeService $programmes,
|
||||
) {}
|
||||
|
||||
public function show(string $shortCode, string $token): View
|
||||
{
|
||||
$resolved = $this->invites->resolvePortal($shortCode, $token);
|
||||
abort_unless($resolved, 404);
|
||||
|
||||
$event = $resolved['event'];
|
||||
$speaker = $resolved['speaker'];
|
||||
$content = $event->content();
|
||||
$programme = null;
|
||||
$programmeSnapshot = null;
|
||||
|
||||
$programmeId = (int) ($content['programme_qr_id'] ?? 0);
|
||||
if ($programmeId > 0) {
|
||||
$programme = \App\Models\QrCode::query()
|
||||
->where('id', $programmeId)
|
||||
->where('type', \App\Models\QrCode::TYPE_ITINERARY)
|
||||
->first();
|
||||
$programmeSnapshot = $this->programmes->snapshot($programme);
|
||||
}
|
||||
|
||||
$token = (string) ($speaker['invite_token'] ?? '');
|
||||
$virtualSessions = collect((array) ($content['virtual_sessions'] ?? []))
|
||||
->filter(fn ($session) => is_array($session) && trim((string) ($session['join_url'] ?? '')) !== '')
|
||||
->map(function (array $session) use ($event, $token) {
|
||||
return [
|
||||
'title' => trim((string) ($session['title'] ?? 'Virtual session')),
|
||||
'type' => in_array($session['meet_room_type'] ?? '', ['webinar'], true) ? 'Webinar' : 'Conference',
|
||||
'scheduled_at' => $session['scheduled_at'] ?? null,
|
||||
'join_url' => $this->invites->speakerJoinUrl($event, $session, $token),
|
||||
];
|
||||
})
|
||||
->values()
|
||||
->all();
|
||||
|
||||
return view('events.speaker-portal', [
|
||||
'event' => $event,
|
||||
'speaker' => $speaker,
|
||||
'eventContent' => $content,
|
||||
'programmeSnapshot' => $programmeSnapshot,
|
||||
'assignments' => $this->invites->assignmentsForSpeaker($event, $speaker),
|
||||
'virtualSessions' => $virtualSessions,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -254,6 +254,9 @@ class QrCodeController extends Controller
|
||||
'customDomainsEnabled' => app(\App\Services\CustomDomain\CustomDomainService::class)->enabled(),
|
||||
'customDomainServerIp' => config('customdomain.server_ip'),
|
||||
'itineraryOptions' => $itineraryOptions,
|
||||
'linkedEventSpeakers' => $qrCode->type === QrCode::TYPE_ITINERARY
|
||||
? app(\App\Services\Events\EventProgrammeService::class)->speakerOptionsForProgramme($qrCode)
|
||||
: [],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user