Cross-cutting migration affecting the entire stack: - Database: 3 migrations splitting name columns with data migration - Models: first_name/last_name on User, Person; contact_first_name/contact_last_name on Company; backward-compatible name accessors - API: all resources return first_name, last_name, full_name; assignablePersons endpoint updated - Requests: validation rules updated for all person/user/company forms - Services: VolunteerRegistrationService, ShiftAssignmentService, InvitationService updated - Frontend: TypeScript types, Zod schemas, all forms split into Voornaam/Achternaam fields - Display: all person/user name references use full_name; initials use first_name[0]+last_name[0] - Tests: all 371 tests passing - Docs: SCHEMA.md and API.md updated Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
881 B
PHP
32 lines
881 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Resources\Api\V1;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
final class MemberResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'first_name' => $this->first_name,
|
|
'last_name' => $this->last_name,
|
|
'full_name' => $this->full_name,
|
|
'email' => $this->email,
|
|
'role' => $this->pivot?->role,
|
|
'avatar' => $this->avatar,
|
|
'event_roles' => $this->whenLoaded('events', fn () =>
|
|
$this->events->map(fn ($event) => [
|
|
'event_id' => $event->id,
|
|
'event_name' => $event->name,
|
|
'role' => $event->pivot->role,
|
|
])
|
|
),
|
|
];
|
|
}
|
|
}
|