Class
Opscale\NotificationCenter\Models\Delivery
Extends Illuminate\Database\Eloquent\Relations\Pivot. Uses DeliveryRepository, HasUlids, and ValidatorTrait.
Database table: notification_center_deliveries
Delivery extends Pivot rather than Model because it sits at the intersection of a notification and a profile, but it carries its own ULID primary key and additional behavioural logic.Attributes
ULID primary key, auto-generated on creation.
Foreign key referencing
notification_center_profiles.id.Foreign key referencing
notification_center_notifications.id.The notification channel used for this delivery attempt (e.g.
mail, webpush, vonage, slack).Current lifecycle status of this delivery. Cast to the
DeliveryStatus enum. Defaults to Pending.A unique 5-character random string generated automatically on creation. Used to build open-tracking URLs. Indexed and unique across all deliveries.
A unique 5-character random string generated automatically on creation only when the parent notification has an
action URL. Used to track click-through events. Indexed and unique across all deliveries.Timestamp of when the delivery record was created.
Timestamp of the last update to the delivery record.
Enums
DeliveryStatus
Opscale\NotificationCenter\Models\Enums\DeliveryStatus
| Value | String | Description |
|---|---|---|
PENDING | 'Pending' | Notification is queued and waiting to be sent. |
FAILED | 'Failed' | Notification failed to be delivered. Terminal state. |
SENT | 'Sent' | Notification has been sent to the recipient. |
RECEIVED | 'Received' | Notification has been received by the recipient. |
OPENED | 'Opened' | Notification has been opened by the recipient. |
VERIFIED | 'Verified' | Notification has been read or acknowledged. Terminal state. |
EXPIRED | 'Expired' | Notification expired before being verified. Terminal state. |
Status transition rules
TheDeliveryStatus enum enforces a strict state machine via canTransitionTo() and allowedTransitions().
| From | Allowed transitions |
|---|---|
Pending | Sent, Failed, Expired |
Sent | Received, Opened, Expired |
Received | Opened, Verified, Expired |
Opened | Verified, Expired |
Verified | (terminal) |
Failed | (terminal) |
Expired | (terminal) |
Relationships
profile
ReturnsBelongsTo — the Profile that this delivery targets.
notification
ReturnsBelongsTo — the Notification this delivery belongs to.
events
ReturnsHasMany — the Event records that have been logged against this delivery (e.g. open, click events).
Tracking slugs
Bothopen_slug and action_slug are generated automatically by the DeliveryRepository trait in the model’s creating lifecycle hook.
open_slug— Always present. Embed this in an invisible tracking pixel or redirect URL to record that the recipient opened the notification.action_slug— Only generated when the notification has a non-nullactionfield. Use this in the call-to-action link to record click-through events.