*/ class PhoneVerificationFactory extends Factory { protected $model = PhoneVerification::class; /** * @return array */ public function definition(): array { return [ 'phone' => '6'.fake()->unique()->numerify('#######'), 'otp' => Hash::make('1234'), 'expires_at' => now()->addMinutes(10), 'verified' => false, ]; } public function expired(): static { return $this->state(fn (array $attributes) => [ 'expires_at' => now()->subMinute(), ]); } public function withOtp(string $otp): static { return $this->state(fn (array $attributes) => [ 'otp' => Hash::make($otp), ]); } }