51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\WebhookRequestFactory;
|
|
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class WebhookRequest extends Model
|
|
{
|
|
/** @use HasFactory<WebhookRequestFactory> */
|
|
use HasFactory, HasUlids;
|
|
|
|
protected $fillable = [
|
|
'webhook_endpoint_id',
|
|
'method',
|
|
'request_uri',
|
|
'headers',
|
|
'query_parameters',
|
|
'body',
|
|
'json_payload',
|
|
'content_type',
|
|
'body_size',
|
|
'ip_address',
|
|
'user_agent',
|
|
'received_at',
|
|
];
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'headers' => 'encrypted:array',
|
|
'query_parameters' => 'encrypted:array',
|
|
'body' => 'encrypted',
|
|
'json_payload' => 'encrypted:array',
|
|
'body_size' => 'integer',
|
|
'received_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function endpoint(): BelongsTo
|
|
{
|
|
return $this->belongsTo(WebhookEndpoint::class, 'webhook_endpoint_id');
|
|
}
|
|
}
|