Resolve MassAssignment Exception _token error in Laravel




MassAssignment Exception error means you are not define fillable variable in modal class. to resolve it define fillable. otherwise to save value without define fillable variable when you going to save data create new instance of modal class and store all attributes and then save this.

Example to MassAssignment Exception:


protected $fillable = ['name','age','mobile'];
to Make fillable all of field
protected $fillable = [];



Example to Save data without MassAssignment:

$data = new ModalClass;
$ata->name = 'saksham';
$data->age = '23';
$data->mobile = '9162896530';
$data->save();



Now you can save data in your database.

No comments

Powered by Blogger.