- PublicRegistrationData now returns registration_fields (portal-visible only), form toggles, and available_tags for tag_picker fields - Volunteer registration accepts field_values and section_preferences with festival_section_id, processed via existing services - PortalMe eager-loads fieldValues and sectionPreferences - Section preferences now use the proper relational table instead of custom_fields JSON Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Controllers\Api\V1;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Api\V1\PortalMeRequest;
|
|
use App\Http\Resources\Api\V1\PersonResource;
|
|
use App\Models\Event;
|
|
use App\Models\Person;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
final class PortalMeController extends Controller
|
|
{
|
|
public function index(PortalMeRequest $request): JsonResponse
|
|
{
|
|
$event = Event::findOrFail($request->validated('event_id'));
|
|
|
|
if ($event->isSubEvent()) {
|
|
$event = $event->parent;
|
|
}
|
|
|
|
$person = Person::where('user_id', $request->user()->id)
|
|
->where('event_id', $event->id)
|
|
->with([
|
|
'crowdType',
|
|
'shiftAssignments.shift.festivalSection',
|
|
'shiftAssignments.shift.timeSlot',
|
|
'volunteerAvailabilities.timeSlot',
|
|
'fieldValues.registrationFormField',
|
|
'sectionPreferences.festivalSection',
|
|
])
|
|
->first();
|
|
|
|
if (! $person) {
|
|
return $this->notFound('No registration found for this event');
|
|
}
|
|
|
|
return $this->success(new PersonResource($person));
|
|
}
|
|
}
|