45 lines
1,005 B
PHP
45 lines
1,005 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Database\Factories\WebhookLogFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class WebhookLog extends Model
|
||
|
|
{
|
||
|
|
/** @use HasFactory<WebhookLogFactory> */
|
||
|
|
use HasFactory, HasUuids;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'webhook_id',
|
||
|
|
'event_type',
|
||
|
|
'payload',
|
||
|
|
'response_status',
|
||
|
|
'response_body',
|
||
|
|
'delivered_at',
|
||
|
|
'failed_at',
|
||
|
|
'attempts',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'payload' => 'array',
|
||
|
|
'response_status' => 'integer',
|
||
|
|
'delivered_at' => 'datetime',
|
||
|
|
'failed_at' => 'datetime',
|
||
|
|
'attempts' => 'integer',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function webhook(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Webhook::class);
|
||
|
|
}
|
||
|
|
}
|