# Add [x] to fillable property to allow mass assignment

Eloquent refused to fill a model from an array because the attribute is not mass assignable. Declare the fillable attributes and pass only validated input.

Message:

```text
Add [title] to fillable property to allow mass assignment on [App\Models\Post].
```

Exception:

```text
Illuminate\Database\Eloquent\MassAssignmentException
```

## What it means

You passed an array to `create`, `update`, `fill` or `new Post([...])`, and Eloquent refused to copy one of its keys onto the model. The docs explain why the guard exists: without it, a visitor could send an extra field such as `is_admin` and, through `create($request->all())`, change a column you never meant to expose. Every model is protected this way by default.

## Why it happens

Whether you get an exception or a silently dropped value depends on the model:

- The model declares neither `Fillable` nor `Guarded`. Every attribute is guarded, and Eloquent throws on the first key: `Add [title] to fillable property to allow mass assignment on [App\Models\Post].` This is the common case right after `php artisan make:model`.
- The model declares `Fillable`, and the array holds a key that is not in it. By default that key is dropped without a word. `Post::create(['title' => 't', 'user_id' => 1])` saves the post with `user_id` empty when the column is nullable. When it is `NOT NULL`, the insert fails with `SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value`, which hides the real cause.
- `Model::preventSilentlyDiscardingAttributes()` is on, so the dropped key throws instead. With a `Fillable` list the message is worded differently: `Add fillable property [user_id] to allow mass assignment on [App\Models\Post].` With a `Guarded` list it is the first wording again. `Model::shouldBeStrict()` turns this on too.

Setting an attribute directly, `$post->user_id = $id`, is not mass assignment and is never blocked. Neither is a query builder `update`, such as `Post::whereKey($id)->update([...])`.

## How to fix it

List the attributes a request may set with the `Fillable` attribute:

```php
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;

#[Fillable(['title', 'body'])]
class Post extends Model
{
}
```

A `protected $fillable = ['title', 'body'];` property works the same way.

Then fill the model from validated data only, and set the sensitive columns yourself:

```php
$validated = $request->validate([
    'title' => ['required', 'string', 'max:255'],
    'body' => ['required', 'string'],
]);

$post = new Post($validated);
$post->user_id = $request->user()->id;
$post->save();
```

To see dropped attributes while you develop, make them throw outside production. The docs place this in the `boot` method of `AppServiceProvider`:

```php
use Illuminate\Database\Eloquent\Model;

Model::preventSilentlyDiscardingAttributes(! $this->app->isProduction());
```

The docs also offer the `Unguarded` attribute, which makes every attribute fillable. Use it only when every array you pass to `fill`, `create` and `update` is one you built by hand.

## Find it in production

With `APP_DEBUG=false` the visitor gets a 500 page titled "Server Error". Laravel reports `MassAssignmentException`, so it is written at error level to `storage/logs/laravel.log`, and Ranetrace's [error monitoring](/features/error-monitoring) records it with its stack trace and the request it happened on.

The silent case leaves nothing in any log, unless a `NOT NULL` column turns it into the 1364 error above. A form that saves but forgets one field, or a column that stays empty, is the sign: compare the keys you pass with the model's `Fillable` list.

Reproduced on Laravel 13.45, PHP 8.5, MySQL 8.0.27, 5 December 2026.

Read more: https://laravel.com/docs/eloquent

## Related

### Terms

- [Eloquent ORM in Laravel](https://ranetrace.com/glossary/eloquent-orm-in-laravel.md)
- [Validation rules in Laravel](https://ranetrace.com/glossary/validation-rules-in-laravel.md)
- [Form requests in Laravel](https://ranetrace.com/glossary/form-requests-in-laravel.md)

### Other errors

- [SQLSTATE\[23000\]: Integrity constraint violation: 1062 Duplicate entry](https://ranetrace.com/error-guides/laravel-sqlstate-1062-duplicate-entry.md)
- [SQLSTATE\[42S22\]: Column not found: 1054 Unknown column](https://ranetrace.com/error-guides/laravel-sqlstate-1054-unknown-column.md)
- [SQLSTATE\[HY000\]: General error: 1364 Field doesn't have a default value](https://ranetrace.com/error-guides/laravel-sqlstate-1364-field-no-default.md)

Read this guide in a browser: https://ranetrace.com/error-guides/laravel-mass-assignment-fillable
