Skip to content

CourseLesson Model

An individual lesson row in fcom_posts, scoped by type and ordered within its course.

Table

  • Table: fcom_posts

  • Primary key: id

  • Extends: Model

Attributes

ColumnTypeNullableDefaultDescription
idBIGINT UNSIGNEDNoPrimary key for the row.
user_idBIGINT UNSIGNEDYesWordPress user ID associated with the row.
parent_idBIGINT UNSIGNEDYesParent row ID used for threading or hierarchy.
titleVARCHAR(192)YesHuman-readable title stored for the record.
slugVARCHAR(192)YesSanitized slug or public identifier.
messageLONGTEXTYesRaw message or body content.
message_renderedLONGTEXTYesRendered 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 UNSIGNEDYesSpace 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_imageTEXTYesFeatured Image stored for this record.
metaLONGTEXTYesSerialized meta payload used by FluentCommunity.
is_stickyTINYINT(1)Yes0Boolean-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)Yes0Numeric priority used for pinned or featured ordering.
expired_atDATETIMEYesExpired At stored for this record.
scheduled_atDATETIMEYesScheduled At stored for this record.
created_atTIMESTAMPYesCreation timestamp maintained by the ORM.
updated_atTIMESTAMPYesUpdate timestamp maintained by the ORM.

Relationships

MethodTypeTargetNotes
topic()belongsToCourseTopicSignature:
course()belongsToCourseSignature:
owner()belongsToUserSignature:
comments()hasManyCommentSignature:
reactions()hasManyReactionSignature:
lessonCompleted()hasManyReactionSignature:
media()hasManyMediaSignature:
terms()belongsToManyTermSignature:

Scopes

ScopeParametersPurpose
SearchBy$query, $searchSearch By scope declared on the model.

Key Methods

MethodDescription
uniqueSlug()unique Slug implemented on the model.
isQuizType()is Quiz Type implemented on the model.
hasUserReact()has User React implemented on the model.

Usage Examples

php
use FluentCommunity\Modules\Course\Model\CourseLesson;

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

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

FluentCommunity developer documentation