Deploy Ladill Events / deploy (push) Successful in 28s
Proxy registration transaction paths on Events, add a join button on the confirmation page, introduce speaker roster management, and replace the QR design wizard with merchant-style create/show flows. Co-authored-by: Cursor <cursoragent@cursor.com>
73 lines
2.3 KiB
PHP
73 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Events;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\QrCode;
|
|
use App\Services\Events\EventSpeakerService;
|
|
use App\Services\Qr\QrCodeManagerService;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class SpeakerController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly EventSpeakerService $speakers,
|
|
private readonly QrCodeManagerService $manager,
|
|
) {}
|
|
|
|
public function hub(Request $request): View
|
|
{
|
|
$account = ladill_account();
|
|
$search = trim((string) $request->query('search', ''));
|
|
|
|
$events = $this->speakers->eventsForAccount($account->id, $search !== '' ? $search : null)
|
|
->map(function (QrCode $event) {
|
|
$event->speaker_count = count($this->speakers->rosterFor($event));
|
|
|
|
return $event;
|
|
});
|
|
|
|
return view('events.speakers-hub', [
|
|
'events' => $events,
|
|
'search' => $search,
|
|
]);
|
|
}
|
|
|
|
public function index(QrCode $event): View
|
|
{
|
|
$this->authorize('view', $event);
|
|
abort_unless($event->type === QrCode::TYPE_EVENT, 404);
|
|
|
|
return view('events.speakers', [
|
|
'qrCode' => $event,
|
|
'roster' => (array) ($event->content()['speakers'] ?? []),
|
|
'programmeAssignments' => $this->speakers->programmeAssignments($event),
|
|
'programme' => $this->speakers->linkedProgramme($event),
|
|
]);
|
|
}
|
|
|
|
public function update(Request $request, QrCode $event): RedirectResponse
|
|
{
|
|
$this->authorize('update', $event);
|
|
abort_unless($event->type === QrCode::TYPE_EVENT, 404);
|
|
|
|
$validated = $request->validate([
|
|
'speakers' => ['nullable', 'array'],
|
|
'speakers.*.name' => ['nullable', 'string', 'max:120'],
|
|
'speakers.*.email' => ['nullable', 'email', 'max:190'],
|
|
'speakers.*.role' => ['nullable', 'string', 'max:80'],
|
|
'speakers.*.bio' => ['nullable', 'string', 'max:500'],
|
|
]);
|
|
|
|
$this->manager->update($event, [
|
|
'speakers' => $validated['speakers'] ?? [],
|
|
]);
|
|
|
|
return redirect()
|
|
->route('speakers.show', $event)
|
|
->with('success', 'Speaker roster saved.');
|
|
}
|
|
}
|