Skip to content

Comment Model

Stores feed comments, threaded replies, and their moderation-aware relationships.

Table

  • Table: fcom_post_comments

  • Primary key: id

  • Extends: Model

Attributes

ColumnTypeNullableDefaultDescription
idBIGINT UNSIGNEDNoPrimary key for the row.
user_idBIGINT UNSIGNEDYesWordPress user ID associated with the row.
post_idBIGINT UNSIGNEDYesAssociated feed post ID.
parent_idBIGINT UNSIGNEDYesParent row ID used for threading or hierarchy.
reactions_countBIGINT UNSIGNEDYes0Cached number of reactions attached to the record.
messageLONGTEXTYesRaw message or body content.
message_renderedLONGTEXTYesRendered HTML representation of the message.
metaLONGTEXTYesSerialized meta payload used by FluentCommunity.
typeVARCHAR(100)Yes'comment'Subtype discriminator for the row.
content_typeVARCHAR(100)Yes'text'Content subtype such as text, document, or survey.
statusVARCHAR(100)Yes'published'Lifecycle or moderation status.
is_stickyTINYINT(1), cast: intYes0Boolean-like flag used for pinned or sticky records.
created_atTIMESTAMPYesCreation timestamp maintained by the ORM.
updated_atTIMESTAMPYesUpdate timestamp maintained by the ORM.

Relationships

MethodTypeTargetNotes
user()belongsToUserSignature:
xprofile()belongsToXProfileSignature:
media()hasOneMediaSignature:
post()belongsToFeedSignature:
space()hasOneThroughBaseSpaceSignature:
reactions()hasManyReactionSignature:

Scopes

ScopeParametersPurpose
SearchBy$query, $searchSearch By scope declared on the model.
ByContentModerationAccessStatus$query, $user, $space = nullBy Content Moderation Access Status scope declared on the model.

Key Methods

MethodDescription
getCommentParentUserIds()Collects the users that participated in a thread for mention and notification workflows.
getHumanExcerpt()Returns a short, human-readable excerpt of the comment body.

Usage Examples

php
use FluentCommunity\App\Models\Comment;

$records = Comment::query()
    ->searchBy('example')
    ->limit(10)
    ->get();

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

FluentCommunity developer documentation