*/ class UserFactory extends Factory { protected static ?string $password; public function definition(): array { return [ 'name' => fake()->name(), 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), 'password' => static::$password ??= Hash::make('password'), 'role' => fake()->randomElement(UserRole::cases())->value, 'phone' => '+7'.fake()->numerify('9#########'), 'is_active' => true, 'remember_token' => Str::random(10), ]; } public function unverified(): static { return $this->state(fn (array $attributes) => [ 'email_verified_at' => null, ]); } }