SanchayaPicker Form Field
The SanchayaPicker form component lets users pick existing files or upload new files directly inside any Filament Resource Form or Schema.
Add HasSanchayaFiles to the form's model to persist the selected attachments automatically. Chunked uploads and image manipulation are planned for the next release.
php
use DP0\Sanchaya\Forms\Components\SanchayaPicker;Single File Attachment
php
SanchayaPicker::make('avatar')
->label('Avatar Image')
->saveInGroup('avatar')
->allowedTypes(['image']);Multiple Files Gallery
php
SanchayaPicker::make('gallery')
->label('Product Gallery')
->multiple()
->maxFiles(8)
->saveInGroup('gallery')
->allowedTypes(['image'])
->uploadMaxFileSize(5120); // 5 MB upload limitMethod Reference
| Method | Description |
|---|---|
multiple(bool $condition = true) | Enable multi-select mode. |
maxFiles(int $count) | Cap the maximum number of selectable files in multiple mode. |
allowedTypes(array $types) | Limit picker results by MIME group, such as ['image', 'video']. |
saveInGroup(string $group) | Polymorphic attachment group name for automatic relation sync. |
uploadMaxFileSize(int $kb) | Per-field upload size limit in KB. |
reorderable(bool $condition = true) | Allow reordering selected files in multiple mode. |
disk(string $disk) | Set the initial disk shown by this picker. |
uploadAcceptedFileTypes(array $types) | Override accepted upload MIME types for this picker. |