I've googled, searched this discord channel and tried hundreds of possibilities, but it just isn;t working for me. It seems simple what I want to do, button calls an action so I can do some lookups etc, then if lookups work I want to chain another action that will display something and call it's own action.
I am on a resource and in the Form code.
class ReturnOrderForm
{
public static function firstAction(): Action
{
return Action::make('first')
->action(function ($livewire) {
// dd($livewire);
$livewire->replaceMountedAction('second');
});
}
public static function secondAction(): Action
{
return Action::make('second')
->requiresConfirmation()
->modalHeading('Step 2')
->action(function ($livewire) {
dd('2');
});
}
Somewhere in my form, I add the folllowing to render the action button.
self::firstAction(),
I did have it as a suffixaction on a textinput but that didnt work either.
TextInput::make('serial')->autofocus()->label('Serial Number')->suffixAction(
self::firstAction()->label('Add')->button()
),
First button action works, I can dd to see this, but second one doesn't fire and I see no errors in Console.