Download the PHP package victorscatolon/filament-attachment-library without Composer
On this page you can find all versions of the php package victorscatolon/filament-attachment-library. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download victorscatolon/filament-attachment-library
More information about victorscatolon/filament-attachment-library
Files in victorscatolon/filament-attachment-library
Package filament-attachment-library
Short Description Easily manage file attachments across multiple models using a clean, polymorphic approach in your Filament app.
License MIT
Informations about the package filament-attachment-library
Filament Attachment Library
Filament Attachment Library is a Laravel package that enables a polymorphic morphMany relationship to handle file attachments across multiple Eloquent models. Seamlessly integrated with Filament, it offers a clean, reusable, and consistent approach to managing file uploads through Filament resource forms and tables—making attachment handling simple and scalable across your application.
🚀 Installation
Install the package via Composer:
Then publish the package's migration files:
⚙️ Configuration
-
Create your model If you haven’t already, create a new Eloquent model:
-
Enable attachments on your model Add the
InteractsWithAttachments
trait to your model to define the polymorphic relationship: -
Add the file upload field to your Filament form In your Filament resource's
form
method, include theAttachmentLibraryFileUpload
component to allow users to upload files: - Enable attachment handling in the CreateRecord component
To ensure attachments are saved properly when creating a new model, use the
HandleAttachments
trait in yourCreateRecord
class:
CreateRecord component
- Enable attachment handling in the EditRecord component Likewise, use the HandleAttachments trait in your EditRecord class to manage attachments during updates:
EditRecord component
🗂️ Relation Managers
To use the Attachment Library within a Relation Manager form, follow these steps:
-
Use the HandleAttachments trait Add the
HandleAttachments
trait to yourRelationManager
class: -
Set
dehydrated(true)
on the file upload field Make sure the attachment field is dehydrated so that the file data is available during form processing: - Add a custom create action to the table
You’ll need to define a custom
CreateAction
with anafter()
callback to manually handle the attachments after the record is created:
✅ Note: Make sure the field name in the $data array matches the field key used in the AttachmentLibraryFileUpload::make() definition.
📦 Changelog
For a detailed list of recent changes, updates, and improvements, please refer to the Changelog.
🤝 Contributing
Contributions are welcome! To get started, please read the Contribution Guide.
👨💻 Credits
Developed and maintained by @victorscatolon.
Thanks to all the amazing contributors who help improve this package.
📄 License
This project is open-source software licensed under the MIT License.
All versions of filament-attachment-library with dependencies
laravel/framework Version ^9.0 || ^10.0 || ^11.0 || ^12.0
filament/support Version ^3.0