MassAssignmentException 🔺 Laravel

Laravel: Illuminate\Database\Eloquent\MassAssignmentException: Add [x] to fillable property to allow mass assignment

You passed an array to create()/update()/fill() containing a field that isn’t in the model’s $fillable list.

Seen on: Laravel

Meaning

Laravel protects models from mass assignment of unexpected fields. Add the field to $fillable (recommended) or use $guarded deliberately — never unguard everything for request data.

Common causes

  • Field not listed in $fillable
  • Using $request->all() with extra fields
  • Model uses $guarded = ['*'] (default)

⚡ Quick fix

  1. Add the attribute to protected $fillable
  2. Pass only validated data ($request->validated())
  3. Use $model->field = value for one-off assignments

Detailed fix by platform

PHP

  1. php
    class Post extends Model
    {
        protected $fillable = ['title', 'body', 'user_id'];
    }
    Post::create($request->validated());

How to diagnose

  1. Model — $fillable/$guarded
  2. Input — Which field is named?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.