Skip to content

Notification Model

Stores notification payloads before they are fanned out to per-user delivery rows.

Table

  • Table: fcom_notifications

  • Primary key: id

  • Extends: Model

Attributes

ColumnTypeNullableDefaultDescription
idBIGINT UNSIGNEDNoPrimary key for the row.
feed_idBIGINT UNSIGNEDYesAssociated feed ID.
object_idBIGINT UNSIGNEDYesAssociated object ID, interpreted together with the object type.
src_user_idBIGINT UNSIGNEDYesUser that triggered the notification or action.
src_object_typeVARCHAR(100)YesSource object type that created the notification.
actionVARCHAR(100)YesAction name stored for the notification or activity.
titleVARCHAR(192)YesHuman-readable title stored for the record.
contentTEXTYesContent stored for this record.
routeTEXTYesPortal route used to open the notification or action destination.
created_atTIMESTAMPYesCreation timestamp maintained by the ORM.
updated_atTIMESTAMPYesUpdate timestamp maintained by the ORM.

Relationships

MethodTypeTargetNotes
subscribers()hasManyNotificationSubscriberSignature:
subscriber()hasOneNotificationSubscriberSignature:
feed()belongsToFeedSignature:
src_user()belongsToUserSignature:
xprofile()belongsToXProfileSignature:

Scopes

ScopeParametersPurpose
ByStatus$query, $status, $userIdBy Status scope declared on the model.
ByType$query, $typeBy Type scope declared on the model.

Key Methods

MethodDescription
getRouteAttribute()Returns the resolved notification route that the portal uses for navigation.
subscribe()subscribe implemented on the model.

Usage Examples

php
use FluentCommunity\App\Models\Notification;

$records = Notification::query()
    ->byStatus(null, 1)
    ->limit(10)
    ->get();

$first = Notification::query()->first();

FluentCommunity developer documentation