Files
landing-api/app/Models/WebhookDelivery.php
Josep Piguillem 9bdbf834f6 Send signed outgoing webhooks
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>
2026-10-01 09:42:39 +02:00

41 lines
942 B
PHP

<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* One attempt to tell a webhook about one event, and how it went.
*/
#[Fillable(['uuid', 'event', 'payload', 'status', 'attempts', 'response_status', 'error', 'delivered_at'])]
class WebhookDelivery extends Model
{
public const PENDING = 'pending';
public const SUCCEEDED = 'succeeded';
public const FAILED = 'failed';
protected function casts(): array
{
return [
'payload' => 'array',
'attempts' => 'integer',
'response_status' => 'integer',
'delivered_at' => 'datetime',
];
}
/**
* @return BelongsTo<Webhook, $this>
*/
public function webhook(): BelongsTo
{
return $this->belongsTo(Webhook::class);
}
}