Repository navigation
submissions
Jacob Martella edited this page Jan 8, 2026
·
1 revision
Form submissions are stored in the database and can be viewed, searched, exported, and processed.
Access submissions at:
-
/admin/forms/submissions- All submissions across all forms -
/admin/forms/{form}/submissions- Submissions for a specific form -
/admin/forms/{form}/submissions/{submission}- Single submission detail
use ArtisanPackUI\Forms\Models\FormSubmission;
// Get all submissions for a form
$submissions = FormSubmission::where('form_id', $formId)
->with('values', 'uploads')
->latest()
->paginate(20);
// Get a single submission
$submission = FormSubmission::with('values', 'uploads')->find($submissionId);
// Access field values
foreach ($submission->values as $value) {
echo $value->field_name . ': ' . $value->value;
}Each submission contains:
| Column | Description |
|---|---|
id |
Unique identifier |
form_id |
Related form ID |
submission_number |
Human-readable number |
ip_address |
Submitter's IP (if enabled) |
user_agent |
Browser user agent (if enabled) |
metadata |
JSON metadata |
created_at |
Submission timestamp |
$submission = FormSubmission::with('values')->find($id);
// Get all values as array
$data = $submission->getFormData();
// ['name' => 'John', 'email' => 'john@example.com']
// Get specific value
$email = $submission->getValue('email');
// Get value with label
$values = $submission->getValuesWithLabels();
// [['label' => 'Email', 'name' => 'email', 'value' => 'john@example.com']]Use the search box to filter by:
- Field values
- Submission number
- Date range
- IP address
use ArtisanPackUI\Forms\Models\FormSubmission;
// Search by value
$submissions = FormSubmission::whereHas('values', function ($query) {
$query->where('value', 'like', '%john%');
})->get();
// Filter by date range
$submissions = FormSubmission::whereBetween('created_at', [
now()->subDays(7),
now(),
])->get();
// Filter by form and status
$submissions = FormSubmission::where('form_id', $formId)
->where('created_at', '>=', now()->subMonth())
->orderBy('created_at', 'desc')
->get();- Go to the form's submissions page
- Click "Export"
- Choose format (CSV, Excel)
- Download the file
use ArtisanPackUI\Forms\Services\ExportService;
$exportService = app(ExportService::class);
// Export to CSV
$csvContent = $exportService->toCsv($form);
// Export to array
$data = $exportService->toArray($form);
// Export with date range
$data = $exportService->toArray($form, [
'start_date' => now()->subMonth(),
'end_date' => now(),
]);use ArtisanPackUI\Forms\Events\FormSubmitted;
class ProcessSubmission
{
public function handle(FormSubmitted $event): void
{
$form = $event->form;
$submission = $event->submission;
// Add to CRM
$this->crm->createContact([
'email' => $submission->getValue('email'),
'name' => $submission->getValue('name'),
]);
// Send to analytics
$this->analytics->track('form_submission', [
'form_id' => $form->id,
'form_name' => $form->name,
]);
}
}For heavy processing, queue the work:
class ProcessSubmission
{
public function handle(FormSubmitted $event): void
{
ProcessSubmissionJob::dispatch($event->submission);
}
}$submission = FormSubmission::find($id);
$submission->delete(); // Also deletes values and uploads// Delete old submissions
FormSubmission::where('created_at', '<', now()->subYear())->delete();
// Or use the prune command
php artisan forms:prune-submissionsConfigure retention in config/artisanpack/forms.php:
'submissions' => [
'retention_days' => 365, // Delete after 1 year
],Schedule the prune command:
// app/Console/Kernel.php or routes/console.php
Schedule::command('forms:prune-submissions')->daily();Submissions are assigned sequential numbers based on the configured format:
'submissions' => [
'submission_number_format' => 'FORM-{year}-{sequence}',
// Results in: FORM-2024-0001, FORM-2024-0002, etc.
],Available placeholders:
-
{year}- Current year -
{month}- Current month (2 digits) -
{day}- Current day (2 digits) -
{sequence}- Sequential number -
{form_id}- Form ID
Store additional metadata with submissions:
use ArtisanPackUI\Forms\Services\SubmissionService;
$submissionService = app(SubmissionService::class);
$submission = $submissionService->create($form, $formData, [
'source' => 'landing-page',
'utm_source' => request('utm_source'),
'utm_campaign' => request('utm_campaign'),
]);
// Access metadata
$source = $submission->getMetadata('source');
$allMeta = $submission->metadata; // JSON decoded array- Notifications - Email notifications for submissions
- File Uploads - Handling uploaded files
- API Reference - Detailed model and service documentation