# Form Submission Repository

To work with the Form Submissions Repository, use the following Facade:

```php
use Statamic\Facades\FormSubmission;
```

## Methods

| Methods | Description |
| ------- | ----------- |
| `all()` | Get all form submissions. |
| `whereForm($handle)` | Get submissions by form handle. |
| `whereInForm($handles)` | Get submissions, across multiple forms. Accepts an array of form handles. |
| `find($id)` | Get a form submission, by its submission ID. |
| `make()` | Makes a new `Submission` instance |
| `query()` | Query Builder |

## Querying

#### Examples {.popout}

#### Get form submissions by form

```php
FormSubmission::whereForm('postbox');
```

#### Get form submissions, between multiple forms

```php
FormSubmission::whereInForm(['postbox', 'newsletter']);
```

#### Get a single submission to a form by its id

```php
FormSubmission::find($id);
```

#### Get form submissions, filtered by field

```php
FormSubmission::query()
    ->where('form', 'postbox')
    ->where('email', 'hoff@statamic.com')
    ->get();
```


## Creating

Start by making an instance of a form submission with the `make` method.
You need to pass in [a `Form` instance](/repositories/form-repository.md) before you can save a form submission.

```php
$form = \Statamic\Facades\Form::find('postbox');

$submission = FormSubmission::make()->form($form);
```

To set submission data, you may call the `->data()` method and pass an array:

```php
$submission->data([
    'name' => 'David Hasselhoff',
    'email' => 'hoff@statamic.com',
]);
```

Finally, save it. It'll return a boolean for whether it succeeded.

```php
$submission->save(); // true or false
```
