*/ class SecurityBlockFactory extends Factory { protected $model = SecurityBlock::class; public function definition(): array { return [ 'instance_id' => Instance::factory(), 'ip' => $this->faker->unique()->ipv4(), 'reason' => 'instance_login', 'attempts' => 10, 'strikes' => 1, 'blocked_at' => now(), 'expires_at' => now()->addHour(), ]; } /** Eine Host- statt Instanz-Sperre, am übergebenen Host. */ public function forHost(Host $host): static { return $this->state(fn () => [ 'instance_id' => null, 'host_id' => $host->id, 'reason' => 'host_ssh', ]); } public function released(): static { return $this->state(fn () => [ 'released_at' => now(), ]); } }