> For the complete documentation index, see [llms.txt](https://docs.astrotomic.info/laravel-translatable/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.astrotomic.info/laravel-translatable/usage/forms.md).

# Forms

## Forms

If you want to translate a field in multiple locales with a single form you can use the overridden `fill()` method which allows you to pass in an array with the locales as first array key and the translated attributes in the sub-array.

```php
$post->fill([
  'en' => [
    'title' => 'My first edited post',
  ],
  'de' => [
    'title' => 'Mein erster bearbeiteter Beitrag',
  ],
]);
```

### Request as array syntax

To achieve this structure in your form - to prevent manipulating the form data just to save them. You can use the input name array `[]` [syntax](https://www.php.net/manual/en/faq.html.php#faq.html.arrays).

```markup
<input type="text" name="en[title]" />
<input type="text" name="de[title]" />
```

### Request as plain syntax

If you want, you can structure the request inputs in colon notation too. Notice that with this approach the attribute goes first.

```markup
<input type="text" name="title:en" />
<input type="text" name="title:de" />
```

### Saving the request

Both ways are ready to save the translatable attributes to the model without any other modification.

```php
public function update(Request $request, Post $post)
{
  $post->update($request->all());
}
```

## Updating the default locale

You can update the default locale attributes by accessing the translatable attributes from the model itself.

```php
$post->title = 'My first post'; // Will update the English translatable model
```

```php
$post->fill(['title' => 'My first post']); // Will update the English translatable model
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.astrotomic.info/laravel-translatable/usage/forms.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
