Skip to content

Tables & models

All models are in Fomvasss\NotifyTemplates\Models, use $guarded = ['id'], and take their table name from config('notify-templates.tables.*'). Each can be replaced through config('notify-templates.models.*').

ColumnTypeDescription
idbigint
notify_keystring(100)Type key
channelstring(50), nullSlot: mail, messenger, custom; null = any
role_keystring(100), nullnull = any role
tenant_idstring(100), nullnull = any tenant
subjecttext, null
bodylongtext, null
optionsjson, nullCast to array; buttons, buttons_columns, your own keys
created_at, updated_attimestamp

Unique index nt_lookup on (notify_key, COALESCE(channel,''), COALESCE(role_key,''), COALESCE(tenant_id,'')).

MethodDescription
static resolve(string $notifyKey, string $channel, ?string $roleKey = null, ?string $tenantId = null): ?staticMost specific row — slot > role > tenant. No config tenant fallback; use the facade for that
getOption(string $key, mixed $default = null): mixeddata_get() on options

notify_role_subscriptions — NotifyRoleSubscription

Section titled “notify_role_subscriptions — NotifyRoleSubscription”
ColumnTypeDescription
idbigint
role_keystring(100)
notify_keystring(100)
tenant_idstring(100), nullnull = all tenants
is_activeboolean, default true
personal_onlyboolean, default falseFor your resolver only
channelsjson, nullChannel slugs; empty = default_channels
optionsjson, nulldelay (minutes) and other settings values
created_at, updated_attimestamp

Unique index nrs_unique on (role_key, notify_key, COALESCE(tenant_id,'')).

MethodDescription
scopeActive()is_active = true
scopeForNotify(string $notifyKey)notify_key = ?
scopeForTenant(?string $tenantId)With a tenant: the tenant’s and global rows; null: global rows
static resolve(string $roleKey, string $notifyKey, ?string $tenantId = null): ?staticTenant row if it exists, otherwise global; doesn’t filter by is_active
getOption(string $key, mixed $default = null): mixeddata_get() on options
getDelaySeconds(): intoptions.delay × 60

notify_user_settings — NotifyUserSetting

Section titled “notify_user_settings — NotifyUserSetting”
ColumnTypeDescription
idbigint
notifiable_typestringMorph class
notifiable_idstringString, so integer and UUID keys both fit
notify_keystring(100)
is_enabledboolean, default true
channelsjson, nullnull = no override
created_at, updated_attimestamp

Unique index nus_unique on (notifiable_type, notifiable_id, notify_key).

MethodDescription
notifiable(): MorphTo
static isEnabledFor(mixed $notifiable, string $notifyKey): booltrue without a row or for a non-model notifiable. Ignores user_configurable — use the facade
static channelsFor(mixed $notifiable, string $notifyKey): ?arrayThe override, or null
ColumnTypeDescription
idbigint
notification_idstring(36)Laravel’s notification id, shared by channels and retries
notify_keystring(100)
channelstringAs returned by via(): mail, telegram, a class name
role_keystring(100), null
tenant_idstring(100), null
notifiable_type, notifiable_idstring, nullnull for on-demand recipients
routestring, nullEmail, chat id, phone
subjectstring, nullSent subject, cut to 255
bodylongtext, nullSent body, unless disabled
statusstring(20)pending, sent, delivered, read, failed
external_idstring, nullProvider message id
errortext, nullFailure message
payloadjson, nullLast provider report or failure data
attemptssmallint, default 1
status_updated_attimestamp, null
created_at, updated_attimestamp

Indexes: notification_id, (channel, external_id), (notifiable_type, notifiable_id), created_at.

MemberDescription
STATUS_PENDING, STATUS_SENT, STATUS_DELIVERED, STATUS_READ, STATUS_FAILEDStatus constants
static statuses(): arrayAll statuses in lifecycle order
static statusLabels(): arrayStatus → translated label (notify-templates::log.statuses.*)
getStatusLabel(): stringLabel of this row’s status
canMoveTo(string $status): boolWhether a report with this status may replace the current one
notifiable(): MorphTo
prunable(): BuilderRows older than log.retention_days (MassPrunable)

The migrations create the tables with the default names. Setting tables.* to other names requires editing the published migrations as well.