Files
2026-08-04 17:09:39 +02:00

44 lines
1.1 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\WebhookEndpoint;
use App\Models\WebhookRequest;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<WebhookRequest>
*/
class WebhookRequestFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'webhook_endpoint_id' => WebhookEndpoint::factory(),
'method' => 'POST',
'request_uri' => '/hook/test',
'headers' => ['content-type' => ['application/json']],
'query_parameters' => [],
'body' => '{}',
'json_payload' => [],
'content_type' => 'application/json',
'body_size' => 2,
'ip_address' => '127.0.0.1',
'user_agent' => 'Webhook Inspector Test',
'received_at' => now(),
];
}
public function forEndpoint(WebhookEndpoint $endpoint): static
{
return $this->state(fn (array $attributes): array => [
'webhook_endpoint_id' => $endpoint->getKey(),
]);
}
}