Skip to content

SanchayaFile & Metadata ​

The SanchayaFile Eloquent model represents every indexed file and directory in Sanchaya.

Metadata & SEO Properties

Property / AccessorTypeDescription
$file->alt_textstringImage alternative text for accessibility & SEO.
$file->titlestringHuman-friendly title attribute.
$file->captionstringMedia caption for galleries.
$file->descriptionstringLong-form description / notes.
$file->getMetadata($key, $default)mixedAccess metadata using dot-notation (e.g. $file->getMetadata('exif.camera')).
$file->setMetadata($key, $value)SanchayaFileSet custom metadata using dot-notation; call save() to persist it.

Core Accessors & Scopes

Accessor / ScopeTypeDescription
$file->display_namestringOriginal upload name or formatted folder name.
$file->url?stringResolved storage URL.
$file->preview_url?stringAccessible public or temporary file URL when the disk supports one.
$file->human_sizestringFormatted size string (e.g., "3.2 MB").
$file->is_image / is_videoboolMIME type helpers.
SanchayaFile::query()->folders()QueryFilter only folders.
SanchayaFile::query()->files()QueryFilter only files.
SanchayaFile::query()->onDisk($disk)QueryFilter by filesystem disk.
SanchayaFile::query()->ofMimeGroup('image')QueryFilter by MIME group.

Released under the MIT License.