Class
Opscale\NotificationCenter\Models\Notification
Extends Illuminate\Database\Eloquent\Model. Uses HasUlids, SoftDeletes, UsesTemplate, and ValidatorTrait.
Database table: notification_center_notifications
Attributes
ULID primary key, auto-generated on creation.
Foreign key referencing a dynamic resources template. Set to
null when the template is deleted. Cast from dynamic_resources_templates.Short subject line for the notification. Maximum 50 characters.
Full message body content. Stored as
longText.Brief summary or preview text. Maximum 100 characters.
Optional datetime after which the notification is considered expired. Cast to
datetime.Optional URL or action target associated with the notification. Maximum 255 characters.
Publication status of the notification. Cast to the
NotificationStatus enum. Defaults to Draft.Category of the notification. Cast to the
NotificationType enum. Defaults to Transactional.Arbitrary JSON payload for dynamic template variables or extra metadata. Cast to
array.Timestamp of when the record was created.
Timestamp of the last update.
Soft-delete timestamp. Present when the record has been soft-deleted.
Enums
NotificationType
Opscale\NotificationCenter\Models\Enums\NotificationType
| Value | String | Description |
|---|---|---|
MARKETING | 'Marketing' | Promotional content, newsletters, and marketing campaigns. |
TRANSACTIONAL | 'Transactional' | Order confirmations, receipts, and account-related updates. |
SYSTEM | 'System' | Platform updates, maintenance notices, and system messages. |
ALERT | 'Alert' | Urgent notifications requiring immediate attention. |
REMINDER | 'Reminder' | Scheduled reminders for tasks, events, or deadlines. |
NotificationStatus
Opscale\NotificationCenter\Models\Enums\NotificationStatus
| Value | String | Description |
|---|---|---|
DRAFT | 'Draft' | The notification is not yet published and will not be dispatched. |
PUBLISHED | 'Published' | The notification is active and eligible for delivery. |
Relationships
audiences
ReturnsBelongsToMany — the Audience models attached to this notification via the notification_center_audience_notification pivot table.
deliveries
ReturnsHasMany — all Delivery records created when this notification was dispatched.
template (via UsesTemplate)
Returns the associated dynamic resource template, if one has been assigned. Provided by theUsesTemplate concern from opscale/nova-dynamic-resources.
Usage examples
Creating a notification
Publishing and attaching audiences
Querying by type and status
Notification uses ULID primary keys. Do not expect integer auto-increment IDs when querying or seeding.