Skip to content

Attachment Model ​

DB Table Name{wp_db_prefix}fbs_attachments
SchemaCheck Schema
Source Filefluent-boards/app/Models/Attachment.php
Name SpaceFluentBoards\App\Models
ClassFluentBoards\App\Models\Attachment

Base model for rows in fbs_attachments. It has no global scope, so it sees every attachment type. The subclasses add the secure URL logic and relations:

SubclassUsed forobject_type
TaskImageImages in task descriptionstask_description
CommentImageImages in commentscomment_image
TaskAttachment (Pro)Files and links attached to a taskTASK

Attributes ​

AttributeData TypeComment
idINT UNSIGNEDPrimary key
object_idINT UNSIGNEDTask, comment or board ID
object_typeVARCHAR(100)TASK, task_description, comment_image or BOARD
attachment_typeVARCHAR(100) NULLurl for links, otherwise the file type
file_pathTEXT NULLLocal file path
full_urlTEXT NULLFile or link URL
settingsTEXT NULLSerialized; returned as an array
titleVARCHAR(192) NULLDisplay title
file_hashVARCHAR(192) NULLRandom hash used in secure URLs
driverVARCHAR(100)local by default
statusVARCHAR(100) NULLACTIVE (default), INACTIVE or DELETED
file_sizeVARCHAR(100) NULLFile size
created_atTIMESTAMP NULL
updated_atTIMESTAMP NULL

Fillable: file_hash, object_type, object_id, settings, file_path, full_url, file_size, attachment_type.

The model declares secure_url as an appended attribute, but only the subclasses define the accessor for it. Use a subclass when you need secure_url or toArray().

Usage ​

Please check Model Basic for common methods.

php
use FluentBoards\App\Models\Attachment;

// Count all active attachments of a task, regardless of subclass
$count = Attachment::where('object_id', 42)
    ->whereIn('object_type', ['TASK', 'task_description'])
    ->where('status', 'ACTIVE')
    ->count();