Fix this error
Laravel: Add [field] to fillable property to allow mass assignment
Dasun Kalupahana 168 views
The error
Error
Add [title] to fillable property to allow mass assignment on [App\Models\Post].
Why it happens
Model::create() and fill() only accept attributes listed in the model's $fillable array. This protects you from users setting fields like is_admin through a form.
How to fix it
- Add the field to
$fillablein the model. - Only list fields users may set; pass validated data, e.g.
Post::create($request->validated()).
class Post extends Model
{
protected $fillable = ['title', 'slug', 'body'];
}
Still stuck? Send us the full error and what you tried. We add the answers here.
Learn more on the blog
MySQL
PostgreSQL vs MySQL Performance: Real Benchmarks Compared
Last updated: 7 November 2026. See the update log at the end."Which...
8 min read
PHP
How to Detect and Fix PHP Memory Leaks
Last updated: 5 November 2026. See the update log at the end.In...
9 min read
Docker
Docker Build Too Slow? 10 Ways to Speed It Up
A slow Docker build usually has one of a few causes: you...
8 min read