How to prefill data after "createAnother" action?

Hey, just wanna maintain some inputs prefilled when I hit the "createAnother" button. I'm trying some Action methods but can't get it :/

protected function getCreateAnotherFormAction(): Action
    {
        return Action::make('createAnother')
            ->label(__('createAnother'))
            ->dispatchSuccessRedirect()
            ->beforeFormFilled(function () {
                $this->data['employee_id'] = request('employee_id');
                $this->data['project_id'] = request('project_id');
                $this->data['date'] = request('date');
                $this->data['imputation_type'] = request('imputation_type');
            })
            ->action('createAnother')
            ->keyBindings(['mod+shift+s'])
            ->color('secondary');
    }
Was this page helpful?