From 713eb3eae8db2f5e7906d0c12090004e5c81a0c7 Mon Sep 17 00:00:00 2001 From: Jack McDade Date: Tue, 31 Mar 2026 21:01:22 -0400 Subject: [PATCH 1/3] Fake Submission Generator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Includes submission-only and full-workflow modes, plus a bulk cleanup action to remove fake submissions. Adds Faker-backed fake data generation, tags generated entries with `fake: true`, includes a configurable “Enable Fake Submission Generator” toggle in form settings, and updates backend safeguards/tests/localization to support the new behavior. --- lang/en/messages.php | 9 + .../js/components/forms/SubmissionListing.vue | 7 + resources/js/pages/forms/Show.vue | 108 +++++ routes/cp.php | 1 + src/Actions/DeleteFakeSubmissions.php | 76 ++++ src/Forms/FakeSubmissionGenerator.php | 397 ++++++++++++++++++ src/Forms/Form.php | 4 + .../CP/Forms/FormSubmissionsController.php | 48 +++ .../Controllers/CP/Forms/FormsController.php | 9 + .../CP/Forms/SubmissionActionController.php | 2 +- src/Providers/ExtensionServiceProvider.php | 1 + .../Forms/DeleteFakeSubmissionsActionTest.php | 122 ++++++ .../Forms/GenerateFakeSubmissionTest.php | 175 ++++++++ 13 files changed, 958 insertions(+), 1 deletion(-) create mode 100644 src/Actions/DeleteFakeSubmissions.php create mode 100644 src/Forms/FakeSubmissionGenerator.php create mode 100644 tests/Feature/Forms/DeleteFakeSubmissionsActionTest.php create mode 100644 tests/Feature/Forms/GenerateFakeSubmissionTest.php diff --git a/lang/en/messages.php b/lang/en/messages.php index ae79894ece6..af4a0b2b945 100644 --- a/lang/en/messages.php +++ b/lang/en/messages.php @@ -133,9 +133,18 @@ 'form_configure_honeypot_instructions' => 'Field name to use as a honeypot. Honeypots are special fields used to reduce bot spam.', 'form_configure_intro' => 'Forms collect information from visitors and can trigger events and send notifications when submissions are received.', 'form_configure_mailer_instructions' => 'Choose the mailer for sending this email. Leave blank to fall back to the default mailer.', + 'form_configure_generate_fake_submissions_instructions' => 'Allow generating fake submissions and workflow testing from the submissions screen.', 'form_configure_store_instructions' => 'Disable to stop storing submissions. Events and email notifications will still be sent.', 'form_configure_title_instructions' => 'Use a call to action, such as \'Contact Us\'.', 'form_create_description' => 'Get started by creating your first form.', + 'form_fake_submissions_deleted' => 'Deleted :count fake submission.|Deleted :count fake submissions.', + 'form_fake_submissions_delete_failed' => 'Fake submissions could not be deleted.', + 'form_fake_submissions_form_not_found' => 'Form could not be found for deleting fake submissions.', + 'form_fake_submissions_none_to_delete' => 'No fake submissions to delete.', + 'form_fake_submissions_partial_delete' => ':success/:total fake submissions were deleted.', + 'form_fake_submission_generation_disabled' => 'Generating fake submissions is disabled for this form.', + 'form_fake_submission_cancelled' => 'Fake submission was cancelled by a form event listener.', + 'form_fake_submission_generated' => 'Fake submission generated.', 'getting_started_widget_collections' => 'Collections hold the different content types that make up your site, helping you stay organized.', 'getting_started_widget_docs' => 'Discover everything Statamic can do, and learn how to use its powerful features the right way.', 'getting_started_widget_header' => 'Getting Started with Statamic', diff --git a/resources/js/components/forms/SubmissionListing.vue b/resources/js/components/forms/SubmissionListing.vue index 27c9b1bd3b3..f3c15a5297c 100644 --- a/resources/js/components/forms/SubmissionListing.vue +++ b/resources/js/components/forms/SubmissionListing.vue @@ -1,5 +1,6 @@