*/ class SecurityAttemptFactory extends Factory { /** * @return array */ public function definition(): array { return [ 'ip_address' => fake()->ipv4(), 'user_agent' => fake()->userAgent(), 'method' => fake()->randomElement(['GET', 'POST']), 'url' => fake()->url(), 'route_name' => fake()->randomElement(['association.profile', 'association.elections', 'association.projectSupport']), 'exception_class' => fake()->randomElement([ ValidationException::class, AuthenticationException::class, AuthorizationException::class, ]), 'exception_message' => fake()->sentence(), 'component_name' => fake()->randomElement(['association.profile', 'association.election.show']), 'target_property' => fake()->randomElement(['name', 'email', 'npub']), 'payload' => ['attempt' => fake()->word()], 'severity' => fake()->randomElement(['low', 'medium', 'high', 'critical']), ]; } public function high(): static { return $this->state(fn () => ['severity' => 'high']); } public function critical(): static { return $this->state(fn () => ['severity' => 'critical']); } }