*/ class WebhookLogFactory extends Factory { protected $model = WebhookLog::class; /** * @return array */ public function definition(): array { return [ 'webhook_id' => Webhook::factory(), 'event_type' => EventType::PostPublished->value, 'payload' => [ 'type' => EventType::PostPublished->value, 'data' => [], ], 'response_status' => 200, 'response_body' => 'OK', 'delivered_at' => now(), 'attempts' => 1, ]; } public function failed(): static { return $this->state(fn (array $attributes): array => [ 'response_status' => 500, 'response_body' => 'Internal Server Error', 'delivered_at' => null, 'failed_at' => now(), ]); } public function pending(): static { return $this->state(fn (array $attributes): array => [ 'response_status' => null, 'response_body' => null, 'delivered_at' => null, 'failed_at' => null, 'attempts' => 1, ]); } }