Files
crewli/api/database/factories/PersonFactory.php
bert.hausmans d2f282eb4c feat: split name into first_name + last_name across users, persons, and companies
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>
2026-04-10 23:04:55 +02:00

41 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\CrowdType;
use App\Models\Event;
use App\Models\Person;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<Person> */
final class PersonFactory extends Factory
{
/** @return array<string, mixed> */
public function definition(): array
{
return [
'event_id' => Event::factory(),
'crowd_type_id' => CrowdType::factory(),
'first_name' => fake('nl_NL')->firstName(),
'last_name' => fake('nl_NL')->lastName(),
'email' => fake()->unique()->safeEmail(),
'phone' => fake('nl_NL')->phoneNumber(),
'status' => 'pending',
'is_blacklisted' => false,
'custom_fields' => null,
];
}
public function approved(): static
{
return $this->state(fn () => ['status' => 'approved']);
}
public function rejected(): static
{
return $this->state(fn () => ['status' => 'rejected']);
}
}