Skip to content

Media Model ​

Stores uploaded media metadata and delivery information for feeds, comments, and spaces.

Table ​

  • Table: fcom_media_archive

  • Primary key: id

  • Extends: Model

Attributes ​

ColumnTypeNullableDefaultDescription
idBIGINT UNSIGNEDNo—Primary key for the row.
object_sourceVARCHAR(100)No—Object Source stored for this record.
media_keyVARCHAR(100)No—Unique key used to identify a stored media object.
user_idBIGINTYes—WordPress user ID associated with the row.
feed_idBIGINTYes—Associated feed ID.
is_activeTINYINT(1)Yes0Boolean-like flag indicating whether the row is currently active.
sub_object_idBIGINTYes—Sub Object ID stored for this record.
media_typeVARCHAR(192)Yes—Media subtype such as image, file, or video.
driverVARCHAR(192)Yes'local'Storage driver used to serve the media file.
media_pathTEXTYes—Internal storage path for the media file.
media_urlTEXTYes—Persisted public URL for the media file.
settingsTEXTYes—Serialized settings payload.
created_atTIMESTAMPYes—Creation timestamp maintained by the ORM.
updated_atTIMESTAMPYes—Update timestamp maintained by the ORM.

Relationships ​

MethodTypeTargetNotes
feed()belongsToFeedSignature: —
user()belongsToUserSignature: —
xprofile()belongsToXProfileSignature: —

Scopes ​

ScopeParametersPurpose
BySource$query, $sources = []By Source scope declared on the model.
ByMediaKey$query, $keyBy Media Key scope declared on the model.
ByUser$query, $userIdBy User scope declared on the model.

Key Methods ​

MethodDescription
getPublicUrlAttribute()Resolves the public URL through the active media driver filter.
getSignedPublicUrl()Builds a temporary signed URL through the active driver when private media is enabled.
deleteFile()Deletes the stored asset from the backing filesystem driver.

Usage Examples ​

php
use FluentCommunity\App\Models\Media;

$records = Media::query()
    ->bySource(null)
    ->limit(10)
    ->get();

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

FluentCommunity developer documentation