Skip to content

Space Model ​

Represents a community space with privacy, membership, topic, and layout settings.

Table ​

  • Table: fcom_spaces

  • Primary key: id

  • Extends: BaseSpace

Attributes ​

ColumnTypeNullableDefaultDescription
created_bystringYes—WordPress user ID that created the record.
parent_idintegerYes—Parent row ID used for threading or hierarchy.
titlestringYes—Human-readable title stored for the record.
slugstringYes—Sanitized slug or public identifier.
descriptionstringYes—Description stored for this record.
logostringYes—Logo stored for this record.
cover_photostringYes—Cover Photo stored for this record.
typestringYes—Subtype discriminator for the row.
privacystringYes—Visibility state used by feeds and spaces.
statusstringYes—Lifecycle or moderation status.
serialintegerYes—Ordering index inside a group of related records.
settingsserializedYes—Serialized settings payload.

Relationships ​

MethodTypeTargetNotes
owner()belongsToUserSignature: —
space_pivot()belongsToSpaceUserPivotSignature: —
admins()belongsToManyUserSignature: —
posts()hasManyFeedSignature: —
comments()hasManyThroughCommentSignature: —
members()belongsToManyUserSignature: —
x_members()belongsToManyXProfileSignature: —
group()belongsToSpaceGroupSignature: —

Scopes ​

ScopeParametersPurpose
SearchBy$query, $searchSearch By scope declared on the model.
OnlyMain$queryOnly Main scope declared on the model.
FilterByUserId$query, $userIdFilter By User Id scope declared on the model.
ByUserAccess$query, $userIdBy User Access scope declared on the model.

Key Methods ​

MethodDescription
defaultSettings()Returns the default settings payload merged into every serialized space settings record.
preloadMemberships()preload Memberships implemented on the model.
isCourseSpace()is Course Space implemented on the model.
isAdmin()is Admin implemented on the model.
updateCustomData()update Custom Data implemented on the model.
isContentSpace()is Content Space implemented on the model.
canViewMembers()can View Members implemented on the model.
verifyUserPermisson()verify User Permisson implemented on the model.
hasPaywallIntegration()has Paywall Integration implemented on the model.
updateCustomMeta()update Custom Meta implemented on the model.
syncTopics()sync Topics implemented on the model.
formatSpaceData()format Space Data implemented on the model.

Usage Examples ​

php
use FluentCommunity\App\Models\Space;

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

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

FluentCommunity developer documentation