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();
    })
];

Can Anyone guide me in the right direction? Thanks !
Was this page helpful?