Skip to content

Activity Model

Tracks member-facing activity stream entries such as feed publications and comments.

Table

  • Table: fcom_user_activities

  • Primary key: id

  • Extends: Model

Attributes

ColumnTypeNullableDefaultDescription
idBIGINT UNSIGNEDNoPrimary key for the row.
user_idBIGINT UNSIGNEDYesWordPress user ID associated with the row.
feed_idBIGINT UNSIGNEDYesAssociated feed ID.
space_idBIGINT UNSIGNEDYesSpace ID stored for this record.
related_idBIGINT UNSIGNEDYesSecondary related object ID used by activity records.
messageTEXTYesRaw message or body content.
is_publicTINYINT(1)Yes1Visibility flag used by activity rows.
action_nameVARCHAR(100)Yes''Action Name stored for this record.
created_atTIMESTAMPYesCreation timestamp maintained by the ORM.
updated_atTIMESTAMPYesUpdate timestamp maintained by the ORM.

Relationships

MethodTypeTargetNotes
feed()belongsToFeedSignature:
space()belongsToBaseSpaceSignature:
user()belongsToUserSignature:
xprofile()belongsToXProfileSignature:

Scopes

ScopeParametersPurpose
ByActions$query, $actions = []By Actions scope declared on the model.
BySpace$query, $spaceIdBy Space scope declared on the model.

Key Methods

MethodDescription
getFormattedMessage()Builds the HTML activity sentence shown in the activity feed for supported activity types.

Usage Examples

php
use FluentCommunity\App\Models\Activity;

$records = Activity::query()
    ->byActions([])
    ->limit(10)
    ->get();

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

FluentCommunity developer documentation