© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago
Джамал

How to save a file from a form in a closure action?

CreateAction::make('addReport')
->model(OrderVehicleReport::class)
->label(('Add report'))
->form([
Select::make('order_vehicle_id')
->relationship('orderVehicle', 'brand')
->label(
('Select car'))
->required()
->options($vehicles),

TextInput::make('stage')
->translateLabel(),

Textarea::make('description')->translateLabel(),

SpatieMediaLibraryFileUpload::make('media')
->minFiles(1)
->required()
->translateLabel()
->openable()
->downloadable()
->collection('images')
->disk(config('media-library.disk_name'))
->multiple()
->reorderable()
->maxFiles(5),

])
->color('gray')
->action(function (array $data) {
//TODO save data and uploaded file spatie media
$a = 2;
})
->icon('heroicon-o-clipboard-document-check')
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to trigger a form save from another action?
FilamentFFilament / ❓┊help
3y ago
Save form from a header action
FilamentFFilament / ❓┊help
16mo ago
Action Save File From FileUpload
FilamentFFilament / ❓┊help
2y ago
Save Action in a separate file
FilamentFFilament / ❓┊help
2y ago