FilamentF
Filament3y ago
eazy

Open an action from another action

I have the following InfoListAction:
Actions::make([
    Action::make('close_configuration')
        ->extraModalFooterActions(fn(Action $action): array => [
            $action
                ->makeModalSubmitAction('createAnother', arguments: ['another' => true])
                ->label(__('machine-configurations.close and create new'))
                ->color('success'),
        ])
        ->requiresConfirmation()
        ->action(function (Machine $record, array $arguments, CloseMachineConfiguration $closeMachineConfiguration, Action $action) {
            if ($record->activeMachineConfiguration === null) {
                return false;
            }

            $closed = $closeMachineConfiguration($record->activeMachineConfiguration);

            if (!$closed) {
                $action->sendFailureNotification();
            }

            if ($closed) {
                $action->sendSuccessNotification();
            }

            if (isset($arguments['another']) && $arguments['another']) {

            }

            return $closed;
        })
])->fullWidth()

Now when the another argument is set I want to open another action that is declared down later on
Was this page helpful?