Files
crewli/api/database/factories/PersonFactory.php
2026-04-11 09:06:29 +02:00

42 lines
1.1 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(),
'date_of_birth' => fake()->dateTimeBetween('-40 years', '-18 years')->format('Y-m-d'),
'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']);
}
}