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:
@@ -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.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user