Fix post-registration 404, add speaker management, and simplify event creation.
Deploy Ladill Events / deploy (push) Successful in 28s
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>
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?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.');
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,13 @@ class QrCodeController extends Controller
|
||||
$requestedType = QrCode::TYPE_EVENT;
|
||||
}
|
||||
|
||||
if ($requestedType === QrCode::TYPE_EVENT) {
|
||||
return view('events.create', [
|
||||
'pricePerQr' => QrWallet::pricePerQr(),
|
||||
'accountEventDefaults' => $qrSettings->resolvedEventDefaults(),
|
||||
]);
|
||||
}
|
||||
|
||||
return view('qr-codes.create', [
|
||||
'wallet' => $wallet,
|
||||
'requestedType' => $requestedType,
|
||||
@@ -213,6 +220,16 @@ class QrCodeController extends Controller
|
||||
->get(['id', 'label'])
|
||||
: collect();
|
||||
|
||||
if ($qrCode->type === QrCode::TYPE_EVENT) {
|
||||
return view('events.show', [
|
||||
'qrCode' => $qrCode,
|
||||
'previewDataUri' => $previewDataUri,
|
||||
'itineraryOptions' => $itineraryOptions,
|
||||
'customDomains' => \App\Models\CustomDomain::where('qr_code_id', $qrCode->id)->get(),
|
||||
'customDomainsEnabled' => app(\App\Services\CustomDomain\CustomDomainService::class)->enabled(),
|
||||
]);
|
||||
}
|
||||
|
||||
return view('qr-codes.show', [
|
||||
'qrCode' => $qrCode,
|
||||
'previewDataUri' => $previewDataUri,
|
||||
|
||||
@@ -36,7 +36,7 @@ class RedirectLegacyQrToLadillLink
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
if ($this->servesStoredAsset($request)) {
|
||||
if ($this->servesStoredAsset($request) || $this->servesRegistrationTransaction($request)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
@@ -64,4 +64,24 @@ class RedirectLegacyQrToLadillLink
|
||||
|
||||
return (bool) preg_match('#^(image/\d+|item-image/\d+/\d+)$#', $suffix);
|
||||
}
|
||||
|
||||
private function servesRegistrationTransaction(Request $request): bool
|
||||
{
|
||||
$shortCode = $request->route('shortCode');
|
||||
if (! is_string($shortCode) || $shortCode === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$path = ltrim($request->path(), '/');
|
||||
$prefix = 'q/'.$shortCode.'/';
|
||||
if (! str_starts_with($path, $prefix)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$suffix = substr($path, strlen($prefix));
|
||||
|
||||
return $suffix === 'register'
|
||||
|| str_starts_with($suffix, 'register/')
|
||||
|| str_starts_with($suffix, 'registered/');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user