How to resolve MassAssignment Exception _token error in Laravel 5.5 ?

It seems you have not defined the fillable attribute in your Model.
Please define it in your model class to allow table attributes as fillable or left it as blank array if you want to columns as fillable.

Example:-

protected $fillable = ['video_title', 'video_url', 'description'];

//To allow all use

protected $fillable = [];

One thought to “How to resolve MassAssignment Exception _token error in Laravel 5.5 ?”

  1. the are many misunderstanding about this subject of this post:

    1) the “mass assignement _token error” happens when you try to create an instance from an array of values non allowed in the “Mass Assignment” protection, this protection work with 2 properties on the model class: $fillable or $guarded … it is very well documented on the official docs https://laravel.com/docs/5.5/eloquent#mass-assignment

    the SOLUTION is to set properly the the accepted fields in the $fillable property for the model class.

    OR

    you could set “_token” as GUARDED but I don’t like it
    protected $guarded = [‘_token’];

    IN ANY WAY THIS CODE BELOW DOESN’T WORK
    protected $fillable = [];

Leave a Reply

Your email address will not be published. Required fields are marked *