Mity Docs Mity Docs for Mity Digital
Form Submission Cleaner Documentation

Query scopes

When Form Submission Cleaner for Statamic is doing its check on what needs to be cleaned up, Submissions are split by form. So we look for:

  • Submissions in the specific form

  • that are older than 30 days (remember, the number of days is a config option)

It is also set up to attach your own Query Scopes to the query.

Params

Your Scope will have a $values parameter, and expect this to be an array. Form Submission Cleaner for Statamic will pass your scope the form handle as the form key on this array.

As defaults

You can set the default query_scopes option to be:

  • a single Scope class, or

  • an array of Scope classes

1'query_scopes' => \App\Scopes\MyScope::class,

or, if you like

1'query_scopes' => [
2 \App\Scopes\MyScope::class,
3 \App\Scopes\MyOtherScope::class,
4]

These Scopes will be applied to all Forms, unless explicitly overridden per form.

For a specific form

You can also set the query_scopes option as part of your Form configuration. Again this can be:

  • a single Scope class, or

  • an array of Scope classes

This is part of your Form-level config, meaning different Forms can use different Scopes, such as:

1'forms' => [
2 'form_handle' => [
3 'query_scopes' => \App\Scopes\MyScope::class
4 ],
5 'another_form_handle' => [
6 'query_scopes' => \App\Scopes\MyOtherScope::class
7 ],
8],

In this example we have different scopes for different Forms.