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_bystringYesWordPress user ID that created the record.
parent_idintegerYesParent row ID used for threading or hierarchy.
titlestringYesHuman-readable title stored for the record.
slugstringYesSanitized slug or public identifier.
descriptionstringYesDescription stored for this record.
logostringYesLogo stored for this record.
cover_photostringYesCover Photo stored for this record.
typestringYesSubtype discriminator for the row.
privacystringYesVisibility state used by feeds and spaces.
statusstringYesLifecycle or moderation status.
serialintegerYesOrdering index inside a group of related records.
settingsserializedYesSerialized 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.
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