Skip to content

Configuration ​

Edit config/filament-sanchaya.php after publishing. The storage directory settings control paths generated by Sanchaya; they do not replace Laravel's configured filesystem disk.

php
return [
    // Eloquent model for file records
    'model' => \DP0\Sanchaya\Models\SanchayaFile::class,

    // Eloquent model for polymorphic attachments
    'attachment_model' => \DP0\Sanchaya\Models\SanchayaAttachment::class,

    // Gate policy for file operations. null = no authorization.
    'policy' => \DP0\Sanchaya\Policies\SanchayaFilePolicy::class,

    // true = soft deletes (recoverable); false = hard delete
    'soft_deletes' => true,

    'allowed_disks' => null,

    'default_disk' => env('SANCHAYA_DEFAULT_DISK', 'public'),

    'storage' => [
        'base_directory' => 'sanchaya',
        'date_format' => 'Y/m',
        'path_generator' => \DP0\Sanchaya\Support\DefaultPathGenerator::class,
    ],

    'file' => [
        'max_file_size'       => 10240,  // KB - 10 MB
        'chunked'             => false,  // Opt in to large-file uploads
        'max_chunked_file_size' => 102400, // KB - 100 MB
        'chunk_size'          => 1024,   // KB - 1 MB per chunk
        'finalizer'           => \DP0\Sanchaya\Actions\FinalizeChunkedUploadAction::class,
        'chunk_upload' => [
            'register_route' => true,
            'route_name' => 'sanchaya.upload-chunk', // Used when register_route is false
            'uri' => 'sanchaya/upload-chunk',
            'require_signed_url' => true,
            'signed_url_expiration' => 120, // minutes
            'middleware' => ['web', 'throttle:600,1'],
        ],
        'accepted_file_types' => [],     // e.g. ['image/*']
    ],

    'storage_quota' => null, // bytes; null = unlimited

    'actions' => [
        'preview' => [
'enabled' => true,
'label' => 'Preview',
'icon' => 'heroicon-m-eye',
        ],
        'download' => [
'enabled' => true,
'label' => 'Download',
'icon' => 'heroicon-m-arrow-down-tray',
'class' => \DP0\Sanchaya\Actions\DownloadAction::class,
        ],
        'create_folder' => [
'enabled' => true,
'label' => 'Create Folder',
'icon' => 'heroicon-m-folder-plus',
'class' => \DP0\Sanchaya\Actions\CreateFolderAction::class,
        ],
        'rename' => [
'enabled' => true,
'label' => 'Rename',
'icon' => 'heroicon-m-pencil',
'class' => \DP0\Sanchaya\Actions\RenameAction::class,
        ],
        'move' => [
'enabled' => true,
'label' => 'Move',
'icon' => 'heroicon-m-arrow-right-circle',
'class' => \DP0\Sanchaya\Actions\MoveAction::class,
        ],
        'copy' => [
'enabled' => true,
'label' => 'Copy',
'icon' => 'heroicon-m-document-duplicate',
'class' => \DP0\Sanchaya\Actions\CopyAction::class,
        ],
        'delete' => [
'enabled' => true,
'label' => 'Delete',
'icon' => 'heroicon-m-trash',
'class' => \DP0\Sanchaya\Actions\DeleteAction::class,
        ],
    ],

    'sanchaya_picker' => [
        'multiple' => false,
        'allowed_types' => [], // e.g. ['image']
        'max_files' => null,
    ],
];

Config Reference

KeyDefaultDescription
modelSanchayaFileEloquent class for file records.
attachment_modelSanchayaAttachmentEloquent class for pivot.
policySanchayaFilePolicyGate policy controlling file operations.
soft_deletestrueWhether deletes are recoverable.
allowed_disksnullList of visible disks; null allows all configured disks.
default_diskpublicDisk shown when the manager opens.
storage.base_directorysanchayaBase directory used for newly generated file paths.
storage.date_formatY/mDate format appended to generated upload paths.
storage.path_generatorDefaultPathGeneratorGenerator class responsible for storage paths.
file.max_file_size10240Upload size limit in KB.
file.chunkedfalseUse the chunked uploader instead of the standard uploader in the manager and picker; picker fields can override with chunked().
file.max_chunked_file_size102400Large-file upload limit in KB.
file.chunk_size1024Maximum upload chunk size in KB; the multipart request is slightly larger.
file.finalizerFinalizeChunkedUploadActionAction used to publish the completed staged upload and create its file record.
file.chunk_upload.route_namesanchaya.upload-chunkApplication route name used only when register_route is false.
file.chunk_upload.urisanchaya/upload-chunkURI registered for chunk requests.
file.chunk_upload.register_routetrueRegister Sanchaya's default chunk endpoint. Set to false when the application provides its own route.
file.chunk_upload.require_signed_urltrueRequire Laravel's temporary signed URL validation. Authentication, authorization, CSRF, and throttling should remain enabled if this is disabled.
file.chunk_upload.signed_url_expiration120Signed URL lifetime in minutes.
file.chunk_upload.middlewareweb, throttle:600,1Middleware applied to the chunk endpoint. The signed middleware is added automatically when required.
file.accepted_file_types[]Accepted upload MIME types; empty allows all types.
storage_quotanullPer-disk upload quota in bytes, based on active indexed files; null means unlimited.
actions.*.enabledtrueEnable or disable a manager action. preview is UI-only; the other actions can use custom classes.
actions.*.labelAction labelText shown for the action in buttons, menus, and notifications.
actions.*.iconHeroicon nameIcon shown for the action in the file manager.
actions.*.classAction classOverride the service class resolved for download, create_folder, rename, move, copy, or delete.
sanchaya_pickerSingle selectionDefault multiple, allowed_types, and max_files values for picker fields.

Storage path behavior

New uploads use the configured base directory followed by the configured date format. With the defaults, a file is stored under a path similar to sanchaya/2026/10/{uuid}.jpg. Existing database paths are not rewritten when these settings change.

The storage.base_directory value is a relative namespace on the selected disk. It is independent from default_disk and from the Laravel filesystem root. For example, changing the base directory to media changes generated paths to media/2026/10/{uuid}.jpg, while the disk remains the selected disk.

SanchayaPicker::directory('products') adds a picker-specific namespace under that base directory. The picker validates browsing, file actions, uploads, and selected IDs against the namespace and disk. It does not change existing stored paths or limit the standalone manager. See Module-specific directory.

Chunked upload settings

Chunked uploads are disabled by default. Enable them globally to use the chunked uploader instead of the standard Livewire uploader in the standalone manager and picker:

php
'file' => [
    'chunked' => true,
    'max_chunked_file_size' => 102400, // KB per file
    'chunk_size' => 1024, // KB per request
],

The chunk size must fit within the server's PHP and web-server request limits. Chunks are staged in storage/app/sanchaya-chunks, assembled, then streamed to the selected disk. Multi-server deployments need shared staging storage or request affinity while an upload is in progress.

Override the chunk finalizer

Replace the default finalizer when your application needs custom validation, storage, metadata, or record creation:

php
'file' => [
    'finalizer' => \App\Actions\FinalizeMediaUploadAction::class,
],

The custom class must implement DP0\Sanchaya\Contracts\ChunkUploadFinalizer. See Customize finalization for the method contract and lifecycle.

Released under the MIT License.