Skip to content

Feed Model ​

Represents community posts, announcements, scheduled posts, and other feed content.

Table ​

  • Table: fcom_posts

  • Primary key: id

  • Extends: Model

Attributes ​

ColumnTypeNullableDefaultDescription
idBIGINT UNSIGNEDNo—Primary key for the row.
user_idBIGINT UNSIGNEDYes—WordPress user ID associated with the row.
parent_idBIGINT UNSIGNEDYes—Parent row ID used for threading or hierarchy.
titleVARCHAR(192)Yes—Human-readable title stored for the record.
slugVARCHAR(192)Yes—Sanitized slug or public identifier.
messageLONGTEXTYes—Raw message or body content.
message_renderedLONGTEXTYes—Rendered HTML representation of the message.
typeVARCHAR(100)Yes'feed'Subtype discriminator for the row.
content_typeVARCHAR(100)Yes'text'Content subtype such as text, document, or survey.
space_idBIGINT UNSIGNEDYes—Space ID stored for this record.
privacyVARCHAR(100)Yes'public'Visibility state used by feeds and spaces.
statusVARCHAR(100)Yes'published'Lifecycle or moderation status.
featured_imageTEXTYes—Featured Image stored for this record.
metaLONGTEXTYes—Serialized meta payload used by FluentCommunity.
is_stickyTINYINT(1), cast: intYes0Boolean-like flag used for pinned or sticky records.
comments_countINT(11), cast: intYes0Cached number of comments attached to the record.
reactions_countINT(11), cast: intYes0Cached number of reactions attached to the record.
priorityINT(11), cast: intYes0Numeric priority used for pinned or featured ordering.
expired_atDATETIMEYes—Expired At stored for this record.
scheduled_atDATETIMEYes—Scheduled At stored for this record.
created_atTIMESTAMPYes—Creation timestamp maintained by the ORM.
updated_atTIMESTAMPYes—Update timestamp maintained by the ORM.

Relationships ​

MethodTypeTargetNotes
user()belongsToUserSignature: —
xprofile()belongsToXProfileSignature: —
space()belongsToBaseSpaceSignature: —
comments()hasManyCommentSignature: —
reactions()hasManyReactionSignature: —
follows()hasManyFollowSignature: —
surveyVotes()hasManyReactionSignature: —
terms()belongsToManyTermSignature: —
activities()hasManyActivitySignature: —
notifications()hasManyNotificationSignature: —
media()hasManyMediaSignature: —

Scopes ​

ScopeParametersPurpose
SearchBy$query, $search, $in = []Search By scope declared on the model.
ByUserAccess$query, $userIdBy User Access scope declared on the model.
ByContentModerationAccessStatus$query, $user, $space = nullBy Content Moderation Access Status scope declared on the model.
ByBookMarked$query, $userIdBy Book Marked scope declared on the model.
ByTopicSlug$query, $topicSlugBy Topic Slug scope declared on the model.
FilterBySpaceSlug$query, $spaceFilter By Space Slug scope declared on the model.
ByType$query, $typeBy Type scope declared on the model.
CustomOrderBy$query, $typeCustom Order By scope declared on the model.
ByStatus$query, $statusBy Status scope declared on the model.
ByFollowing$query, $userId = nullBy Following scope declared on the model.
FilterByUserId$query, $userIdFilter By User Id scope declared on the model.

Key Methods ​

MethodDescription
getHumanExcerpt()Returns a short excerpt used in notifications and activity messages.
hasEditAccess()Checks whether the current user can edit the feed item.
updateCustomMeta()Persists a single custom meta value on the feed record.
getCustomMeta()Reads a single custom meta value from the serialized feed meta payload.
withPublicRelations()with Public Relations implemented on the model.
hasUserReact()has User React implemented on the model.
attachTopics()attach Topics implemented on the model.
recountStats()recount Stats implemented on the model.
isEnabledForEveryoneTag()is Enabled For Everyone Tag implemented on the model.

Usage Examples ​

php
use FluentCommunity\App\Models\Feed;

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

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

FluentCommunity developer documentation