Skip to content

Reaction Model

Stores likes and survey votes for feeds, comments, and course content.

Table

  • Table: fcom_post_reactions

  • Primary key: id

  • Extends: Model

Attributes

ColumnTypeNullableDefaultDescription
idBIGINT UNSIGNEDNoPrimary key for the row.
user_idBIGINT UNSIGNEDYesWordPress user ID associated with the row.
object_idBIGINT UNSIGNEDYesAssociated object ID, interpreted together with the object type.
parent_idBIGINT UNSIGNEDYesParent row ID used for threading or hierarchy.
object_typeVARCHAR(100)Yes'feed'Discriminator used to reuse the same table for multiple object types.
typeVARCHAR(100)Yes'like'Subtype discriminator for the row.
ip_addressVARCHAR(100)YesIp Address stored for this record.
created_atTIMESTAMPYesCreation timestamp maintained by the ORM.
updated_atTIMESTAMPYesUpdate timestamp maintained by the ORM.

Relationships

MethodTypeTargetNotes
user()belongsToUserSignature:
xprofile()belongsToXProfileSignature:
feed()belongsToFeedSignature:
comment()belongsToCommentSignature:

Scopes

ScopeParametersPurpose
TypeBy$query, $type = 'like'Type By scope declared on the model.
ObjectType$query, $type = 'feed'Object Type scope declared on the model.

Key Methods

MethodDescription
No additional public methods are documented for this model.

Usage Examples

php
use FluentCommunity\App\Models\Reaction;

$records = Reaction::query()
    ->typeBy('example')
    ->limit(10)
    ->get();

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

FluentCommunity developer documentation