© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
5 replies
H4L1M

Save Action in a separate file

hello , can I save the actions in a separate file to use it in multiple places and avoid code duplication..
thank you ..
Solution
@Leandro Ferreira Was just wondering and thought to add a question maybe some else will have the same ... , figured that I can add a method like userform() that returns an array in the related model "User" for example
public static function userForm() {
 return [
textinput::make('email'),
.....
];
}
public static function userForm() {
 return [
textinput::make('email'),
.....
];
}

then just call it like
User::userForm()
User::userForm()

wherever I want the form
Jump to solution
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

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