Also: StoresUtc trait normalizes datetime casts to UTC (controller ruling). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCrwHHnGCB5XH968Nxokqw
38 lines
777 B
PHP
38 lines
777 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\DeliveryResult;
|
|
use App\Models\Concerns\StoresUtc;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Delivery extends Model
|
|
{
|
|
use StoresUtc;
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $attributes = ['meta' => '{}'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'result' => DeliveryResult::class,
|
|
'window_start' => 'immutable_datetime',
|
|
'sent_at' => 'immutable_datetime',
|
|
'meta' => 'array',
|
|
];
|
|
}
|
|
|
|
public function event(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Event::class);
|
|
}
|
|
|
|
public function channel(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Channel::class);
|
|
}
|
|
}
|