F
Filamentβ€’7mo ago
JJSanders

Custom action modal

Hello, I have got the following question. I have created a custom action. The action gennerally doesn't need a modal. But sometimes the action does need a model which should then show a form in the modal where the user should fill out some input (this needs to be validated etc) I can't figure out how to show the modal conditionally. My code at the moment looks like this:
Actions\Action::make('Connect ingredients')
->action(function(Product $product){
//(... removed some code for simplicity)
$decider->decide();
$product->fresh();
if ($decider->getMessages()) {
// Here I want to show a modal with a custom form etc.
}

Notification::make()
->title('Sucessfull')
->color('success')
->send();
})
];
Actions\Action::make('Connect ingredients')
->action(function(Product $product){
//(... removed some code for simplicity)
$decider->decide();
$product->fresh();
if ($decider->getMessages()) {
// Here I want to show a modal with a custom form etc.
}

Notification::make()
->title('Sucessfull')
->color('success')
->send();
})
];
Can Anyone guide me in the right direction? Thanks !
6 Replies
JJSanders
JJSandersOPβ€’7mo ago
Anyone on this one?
JJSanders
JJSandersOPβ€’7mo ago
I thinks I can do with this. Let me try it out. This is another hidden gem in filament πŸ˜‰
LeandroFerreira
LeandroFerreiraβ€’7mo ago
worked?
JJSanders
JJSandersOPβ€’7mo ago
The custom action model worked indeed. But the whole thing is more complex because I need to make a whole custom modal with a custom form. So still not sure if this is the way to go
toeknee
toekneeβ€’7mo ago
use ->form() with the custom action?
Want results from more Discord servers?
Add your server