*/ class OtpCodeFactory extends Factory { public function definition(): array { return [ 'phone' => '09' . fake()->numerify('#########'), 'code' => (string) fake()->numberBetween(1000, 9999), 'expires_at' => now()->addMinutes(3), ]; } public function expired(): static { return $this->state(fn (array $attributes) => [ 'expires_at' => now()->subMinute(), ]); } }