All packages
Forms for Laravel
Drafts (save & resume)
Save a partial submission now and finalize it later. Drafts skip validation; finalizing runs full validation before promoting the draft to a final submission:
$draft = Forms::draft($form, request(), $user); // returns SubmissionResult with a uuid
// ...later, resume by reusing the uuid (overwrites the prior draft values):
Forms::draft($form, request(), $user, uuid: $draft->uuid);
// finalize — validates, then marks the rows final and dispatches FormSubmitted:
Forms::finalize($draft->uuid); // or Forms::submission($draft->uuid)->finalize()- draft() stores every field’s current value with the draft status and returns a SubmissionResult — keep its uuid to resume.
- Resuming with uuid: replaces that draft’s stored values with the new request’s values — and its uploads: the old files are deleted.
- finalize() rebuilds the input from the stored values, validates it, marks the rows and the aggregate final, then dispatches FormSubmitted. Uploads are validated as the files they were, so file, mimes and max rules apply, and a field its conditions now hide keeps no value.
- Only a draft of the same form, saved by the same sender, can be resumed: a finalized submission’s uuid, another form’s draft, another sender’s draft (an anonymous draft stays anonymous) or a malformed uuid throws DraftNotFoundException and leaves the stored submission untouched.
- finalize() with an unknown draft uuid also throws DraftNotFoundException; failed validation throws as usual and the draft stays a draft.
- Two finalizes racing for one draft promote it once: the other throws DraftNotFoundException and fires nothing.
- Drafts are excluded from final-submission reads by default.
Querying draft rows
use RoundlyConsulting\Forms\Enums\SubmissionStatus;
use RoundlyConsulting\Forms\Models\Submission;
Submission::query()->draft()->where('uuid', $uuid)->get(); // draft rows
Submission::query()->final()->count(); // final rows (no status counts as final)
$row->isDraft(); // bool
$row->status === SubmissionStatus::Draft; // the per-row status enumShow your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.