*/ class UserFactory extends Factory { /** * The current password being used by the factory. */ protected static ?string $password; /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'username' => fake()->unique()->userName(), 'email' => fake()->unique()->safeEmail(), 'role' => 'user', 'disabled' => false, 'password' => static::$password ??= Hash::make('password'), ]; } }