diff --git a/database/factories/.gitkeep b/database/factories/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php new file mode 100644 index 000000000..0383a7e03 --- /dev/null +++ b/database/factories/UserFactory.php @@ -0,0 +1,42 @@ + + */ +final class UserFactory extends Factory +{ + /** + * The current password being used by the factory. + */ + private static string $password; + + /** + * Define the model's default state. + */ + public function definition(): array + { + return [ + 'name' => fake()->name(), + 'email' => fake()->unique()->safeEmail(), + 'email_verified_at' => now(), + 'password' => self::$password ??= Hash::make('password'), + ]; + } + + /** + * Indicate that the model's email address should be unverified. + */ + public function unverified(): static + { + return $this->state(fn (array $attributes): array => [ + 'email_verified_at' => null, + ]); + } +}