Skip to main content

Add [name] to fillable property to allow mass assignment on [App\Customer].

This mass assignment error occurs when you don't declare protected or guarded to your model.

so, just write

protected $fillable=[
             'name',
];

or,
protected $guarded=[];

both are same. $guarded is the opposite of $fillable but acts the same. but if you put name inside $guarded like: $guarded =['name'], than it will only guard this means it will not allow you to give data to name. so, living guarded blank is same as protected $fillable =['name'];

Comments

Popular posts from this blog