Advanced

Events & Hooks

Listen to form events and extend submission processing.

FilaForms dispatches events at key points in the form lifecycle. Use standard Laravel event listeners to hook into form submissions, send custom notifications, sync data, or trigger workflows.

FormSubmitted Event

Dispatched after a form submission is successfully processed and stored.

Properties:

PropertyTypeDescription
$formForm modelThe form that was submitted
$submissionFormSubmission modelThe stored submission record
app/Listeners/SyncToCrm.php
use FilaForms\Core\Events\FormSubmitted;

class SyncToCrm
{
    public function handle(FormSubmitted $event): void
    {
        $form = $event->form;
        $submission = $event->submission;
        $data = $submission->data['custom_fields'];

        // Sync to your CRM, send to Slack, etc.
    }
}

Registering Listeners

Register in your EventServiceProvider:

app/Providers/EventServiceProvider.php
use FilaForms\Core\Events\FormSubmitted;
use App\Listeners\SyncToCrm;

protected $listen = [
    FormSubmitted::class => [
        SyncToCrm::class,
    ],
];

Or register inline in a service provider:

app/Providers/AppServiceProvider.php
use FilaForms\Core\Events\FormSubmitted;
use Illuminate\Support\Facades\Event;

Event::listen(FormSubmitted::class, function (FormSubmitted $event) {
    logger()->info('Form submitted', [
        'form' => $event->form->name,
        'submission_id' => $event->submission->id,
    ]);
});

Built-in Listener

SendFormNotifications listens to FormSubmitted automatically. It handles admin email notifications, auto-responses to submitters, and in-app notifications. It implements ShouldQueue and runs on the queue.

You do not need to register SendFormNotifications yourself. It is registered by the package and respects the notification settings configured on each form.

Custom Models

Override the default FilaForms models to add custom behavior, relationships, or scopes.

app/Providers/AppServiceProvider.php
use FilaForms\Core\FilaForms;
use App\Models\CustomForm;
use App\Models\CustomSubmission;
use App\Models\CustomEvent;

FilaForms::useFormModel(CustomForm::class);
FilaForms::useSubmissionModel(CustomSubmission::class);
FilaForms::useEventModel(CustomEvent::class);

Custom models should extend the base FilaForms models:

app/Models/CustomForm.php
use FilaForms\Core\Models\Form;

class CustomForm extends Form
{
    // Add custom relationships, scopes, etc.
}

Post-Submit Actions

Register custom actions that run after a submission is stored. Actions implement the PostSubmitActionHandler contract.

app/Providers/Filament/AdminPanelProvider.php
use FilaForms\Core\Contracts\PostSubmitActionHandler;

FilaFormsPlugin::make()
    ->registerPostSubmitAction(new CustomPaymentAction())
    ->defaultPostSubmitAction('custom_payment');

Table Customization

Customize the forms and submissions tables in the admin panel.

app/Providers/Filament/AdminPanelProvider.php
FilaFormsPlugin::make()
    ->configureFormsTable(function ($table) {
        return $table->defaultSort('created_at', 'desc');
    })
    ->configureSubmissionsTable(function ($table) {
        return $table->poll('10s');
    });
Copyright © 2026