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 UNSIGNEDNo—Primary key for the row.
feed_idBIGINT UNSIGNEDYes—Associated feed ID.
object_idBIGINT UNSIGNEDYes—Associated object ID, interpreted together with the object type.
src_user_idBIGINT UNSIGNEDYes—User that triggered the notification or action.
src_object_typeVARCHAR(100)Yes—Source object type that created the notification.
actionVARCHAR(100)Yes—Action name stored for the notification or activity.
titleVARCHAR(192)Yes—Human-readable title stored for the record.
contentTEXTYes—Content stored for this record.
routeTEXTYes—Portal route used to open the notification or action destination.
created_atTIMESTAMPYes—Creation timestamp maintained by the ORM.
updated_atTIMESTAMPYes—Update 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