Add a Create and edit button

In a RelationManager: How can I use custom or CreateAction to Create the record and keep editing and not Close the modal
Solution:
Turns out it is easy once I know to add this to my CreateAction
Jump to solution
6 Replies
Matthew
Matthew2mo ago
Not sure what you mean....what is the use case for this ?
ddoddsr
ddoddsrOP2mo ago
In the a RelationManager List I have a CreateAction::make() Which opens a modal that has a create button. When tht button is used the record is created and the modal is closed I would like to keep the modal open refreshed with any data from the ->mutateFormDataUsing of the CreateAction And make a Save Button that saves progress without closing modal.
toeknee
toeknee2mo ago
Add a custom action? which saves the state and then re-populates the form with the saved model.
ddoddsr
ddoddsrOP2mo ago
Exactly for the Save Action but for the CreateAction it would be best if I could use built-in to make sure I get all the nessasary parts for example my custom create Action saves a record but the $context did not change so the create button remains visible with ->visible(fn (string $context): bool => $context === 'create') on the Action.
Solution
ddoddsr
ddoddsr2mo ago
Turns out it is easy once I know to add this to my CreateAction
ddoddsr
ddoddsrOP2mo ago
->after(function ($record) {
$this->replaceMountedTableAction('edit', $record->id);
})
->after(function ($record) {
$this->replaceMountedTableAction('edit', $record->id);
})
Want results from more Discord servers?
Add your server