Fed by the records themselves, delivered only to public HTTPS addresses checked at every attempt, retried, and switched off after repeated failures. A submitter's details travel only to webhooks that opted into them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
890 B
PHP
35 lines
890 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\WebhookDelivery;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/**
|
|
* @mixin WebhookDelivery
|
|
*/
|
|
class WebhookDeliveryResource extends JsonResource
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'uuid' => $this->uuid,
|
|
'event' => $this->event,
|
|
'status' => $this->status,
|
|
'attempts' => (int) $this->attempts,
|
|
'response_status' => $this->response_status,
|
|
'error' => $this->error,
|
|
'payload' => (object) ($this->payload ?? []),
|
|
'delivered_at' => $this->delivered_at?->toIso8601String(),
|
|
'created_at' => $this->created_at?->toIso8601String(),
|
|
];
|
|
}
|
|
}
|