Attachmate
Manage attachments with polymorphic relationship.
Author:
Zeeshan Tariq
Documentation
This package provides attachment management using a polymorphic morphMany relationship within Filament. The system allows for the seamless association of attachments with various models, enabling flexible and efficient handling of file attachments across your application.

#Installation
You can install the package via composer:
composer require zeeshantariq/filament-attachmate
#Filament version compatibility
Use the package version that matches your Filament major version:
- Filament v3:
^1.1(e.g.v1.1.1) - Filament v4:
^1.2(starting fromv1.2.0) - Filament v5:
^1.2(starting fromv1.2.0)
Examples:
# Filament v3
composer require zeeshantariq/filament-attachmate:^1.1
# Filament v4 or v5
composer require zeeshantariq/filament-attachmate:^1.2
The package comes with publishable assets:
Migrations
php artisan vendor:publish --tag="filament-attachmate-migrations"
#Configuration
- Create your model
php artisan make:model MyModel
- Configure your model to handle morphMany attachments
use ZeeshanTariq\FilamentAttachmate\Core\InteractsWithAttachments;
// ...
class MyModel extends Model
{
use InteractsWithAttachments;
// ...
}
- Configure the Filament resource
- In your
formFilament resource declaration you need to addAttachmentFileUpload::make()so your users can upload the attachments.
use ZeeshanTariq\FilamentAttachmate\Forms\Components\AttachmentFileUpload;
public static function form(Form $form): Form
{
return $form
->schema([
// ...
AttachmentFileUpload::make(),
]);
}
- Configure the Filament resource The last configuration needed, is to add HandleAttachmets trait to the CreateRecord components of your model
CreateRecord component
use ZeeshanTariq\FilamentAttachmate\Core\HandleAttachments;
class CreateMyModel extends CreateRecord
{
use HandleAttachments;
// ...
}
- Configure the Filament resource The last configuration needed, is to add HandleAttachmets trait to the EditRecord components of your model
EditRecord component
use ZeeshanTariq\FilamentAttachmate\Core\HandleAttachments;
class EditMyModel extends EditRecord
{
use HandleAttachments;
// ...
}
#Changelog
Please see CHANGELOG for more information on what has changed recently.
#Contributing
Please see CONTRIBUTING for details.
#Credits
#License
The MIT License (MIT). Please see License File for more information.
The author
From the same author
Featured Plugins
A selection of plugins curated by the Filament team
Custom Dashboards
Let your users build and share their own dashboards with a drag-and-drop interface. Define your data sources in PHP and let them do the rest.
Filament
Spotlight Pro
Browse your Filament Panel with ease. Filament Spotlight Pro adds a Spotlight/Raycast like Command Palette to your Filament Panel.
Dennis Koch
Custom Fields
Eliminate custom field migrations forever. Let your users create and manage form fields directly in Filament admin panels with 20+ built-in field types, validation, and zero database changes.
Relaticle