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 UNSIGNEDNoPrimary key for the row.
object_sourceVARCHAR(100)NoObject Source stored for this record.
media_keyVARCHAR(100)NoUnique key used to identify a stored media object.
user_idBIGINTYesWordPress user ID associated with the row.
feed_idBIGINTYesAssociated feed ID.
is_activeTINYINT(1)Yes0Boolean-like flag indicating whether the row is currently active.
sub_object_idBIGINTYesSub Object ID stored for this record.
media_typeVARCHAR(192)YesMedia subtype such as image, file, or video.
driverVARCHAR(192)Yes'local'Storage driver used to serve the media file.
media_pathTEXTYesInternal storage path for the media file.
media_urlTEXTYesPersisted public URL for the media file.
settingsTEXTYesSerialized settings payload.
created_atTIMESTAMPYesCreation timestamp maintained by the ORM.
updated_atTIMESTAMPYesUpdate 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