Auto save form
Hey guys π , in our legacy system we have the following functionality:
when the user enters a form, he already creates a record in the database with the status of "Draft", and so the user can leave and finish sending later, the status only changes when sending through the submit button.
How could I develop this same functionality in Filament?
In pure PHP we use jquery and AJAX, but in Laravel I got a little lost.
If anyone can help me with this part I would be very grateful. π€
4 Replies
try to see if this helps
https://filamentphp.com/docs/2.x/admin/resources/creating-records
and go to #Lifecycle hooks
Filament
Creating records - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
you can use the before to do this action I think
basically before opening the form it can create a record, then you can use the beforefill I think to show the data filled in according to the previously created
You can run the function afterValidated
You can use lifecycle hooks for that. Hook into
beforeFill
hook on the create page, create your record, then $this->redirect(static::getResource()::getUrl('edit', ['record' => $record])