Implement webhook inspector
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user