54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\NotificationChannel;
|
|
use App\Enums\NotificationDeliveryStatus;
|
|
use App\Enums\NotificationEventType;
|
|
use Database\Factories\NotificationDeliveryLogFactory;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
#[Fillable([
|
|
'attempt_count',
|
|
'channel',
|
|
'delivered_at',
|
|
'delivery_status',
|
|
'error_excerpt',
|
|
'event_type',
|
|
'http_status',
|
|
'last_attempted_at',
|
|
'notification_action_id',
|
|
'payload_metadata',
|
|
'response_excerpt',
|
|
])]
|
|
class NotificationDeliveryLog extends Model
|
|
{
|
|
/** @use HasFactory<NotificationDeliveryLogFactory> */
|
|
use HasFactory;
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'attempt_count' => 'integer',
|
|
'channel' => NotificationChannel::class,
|
|
'delivered_at' => 'datetime',
|
|
'delivery_status' => NotificationDeliveryStatus::class,
|
|
'event_type' => NotificationEventType::class,
|
|
'http_status' => 'integer',
|
|
'last_attempted_at' => 'datetime',
|
|
'payload_metadata' => 'array',
|
|
];
|
|
}
|
|
|
|
public function notificationAction(): BelongsTo
|
|
{
|
|
return $this->belongsTo(NotificationAction::class);
|
|
}
|
|
}
|