*/ class CustomerFactory extends Factory { protected $model = Customer::class; #[\Override] protected function withFaker() { return class_exists(\Faker\Generator::class) ? parent::withFaker() : null; } public function definition(): array { return $this->faker !== null ? $this->definitionWithFaker() : $this->definitionStatic(); } /** @return array */ private function definitionWithFaker(): array { return [ 'email' => fake()->unique()->email(), 'hashcode' => fake()->unique()->uuid(), 'username' => fake()->unique()->userName(), ]; } /** @return array */ private function definitionStatic(): array { return [ 'email' => 'client.test@exemple.org', 'hashcode' => '00000000-0000-0000-0000-000000000000', 'username' => 'client_demo', ]; } }