Skip to content

File ​

File: src/Entities/File.php
Namespace: Unusualify\Modularous\Entities
Extends: Model
Traits: HasFactory, HasCreator

Represents an uploaded non-image file in the file library. Stores the file's UUID-based storage path, original filename, and byte size.

Fillable Attributes ​

AttributeTypeDescription
uuidstringUUID-based storage path
filenamestringOriginal filename
sizeintFile size in bytes

Accessors ​

AccessorTypeDescription
size_for_humanstringHuman-readable size (e.g. "2.4 MB")
size_in_mbfloatSize in megabytes

Methods ​

canDeleteSafely(): bool ​

Returns true when the file is not referenced in the fileables pivot table.

scopeUnused($query) ​

Returns all files not referenced in any fileables record.

mediableFormat(): array ​

Formats the file into the structure expected by the frontend: id, name, src, original, size, filesizeInMb.