F
Filament10mo ago
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 ```php public static function userForm() { return [ textinput::make('email'),...
Jump to solution
3 Replies
LeandroFerreira
LeandroFerreira10mo ago
yes. What is the issue?
Solution
H4L1M
H4L1M10mo ago
@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
H4L1M
H4L1MOP10mo ago
any other suggestions?
Want results from more Discord servers?
Add your server