简体   繁体   中英

Laravel Mass Assignment Error

I have tried multiple troubleshooting steps on this site about this error. Already added a $fillable and updated with composer but I am still getting the same error. Here is a screen shot of the error that I am experiencing and the codes for my Model.php .

Laravel Error message

Model Codes

Have you:

protected $fillable = ['body'];

in your model? If not add that property to your model.

As per laravel document for Mass Assignment , you should define which model attributes you want to make mass assignable. You may do this using the $fillable property on the model.

 protected $fillable = ['name'];

The inverse of fillable is guarded returns opposite-list

The fillable property specifies which attributes should be mass-assignable. This can be set at the class or instance level.

remove $guarded

 protected $fillable = ['YourAttribute'];

In your model

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM