laravel 5 mass assignment problem fix

If you are a laravel developer and getting an error when your are trying to insert data into database table then you get an error like as Mass assignment. You are getting this kind of message error message for the security issues of laravel framework.


You can fix this issues in 2 way.

First one: Put the code in your model. Please mention all the field which you want to insert into your table.


Example: $fillable=[‘name’,’email’,’phone’];

Second One : You can insert data by creating an object of your model,like as

$contact=new Contact();

In this example my model is Contact.


Share on :

Leave a Reply

seven + 2 =