I am trying to create a custom button at the bottom of a resource that will save the record and then take all of the information in that record and duplicate it into another record.
This duplicated/copied information would then give the user a jumpstart to enter another record. Right now the only actions on the Create and Update pages are Create/Update, Create/Update and Add Another but those two buttons don’t fit all circumstances. And the last option just provides a blank form. I want the previously entered information to be auto-added to the form to save time.
And I am aware of the replicate function. But this requires the record to be saved and the user to return to the record and then select the replicate option. When I have users entering hundreds of items at a time, this extra step is very time consuming.
Can somebody help me figure out a way to add additional buttons to the forms so that I can extend the create and update functionality?
2
Answers
Have you tried using the Replicate action on a resource? I believe this does exactly what you are looking for! You can read more about replicate at https://nova.laravel.com/docs/resources/
If you need a quick solution to pre-hydrate the form fields for a new resource with the same values as the last resource created, you could try something like: