Laravel 4.1 _token error on form submit

I make simple cms in laravel 4.1, I created a lot of forms and they work fine, but the last form I create causes an error while submitting.

Illuminate \ Database \ Eloquent \ MassAssignmentException _token 

Form submissions are also displayed on the error page.

 _token KLlDjuFgaEmuGHKMpFjqSrukYT3sawOYYZLPGxnb name asdf body asdfasdfa bio sdfasdf 

So this means that _token is also sent then why I get this error.

My form looks like this.

 {{ Form::open(array('route' => 'admin.teachers.store','files'=>true)) }} <ul> <li> {{ Form::label('image', 'Image:') }} {{ Form::file('image') }} </li> <li> {{ Form::label('name', 'Name:') }} {{ Form::text('name') }} </li> <li> {{ Form::label('body', 'Body:') }} {{ Form::textarea('body',null,array('class'=>'ckeditor')) }} </li> <li> {{ Form::label('bio', 'Bio:') }} {{ Form::textarea('bio',null,array('class'=>'ckeditor')) }} </li> <li> {{ Form::submit('Submit', array('class' => 'btn btn-info')) }} </li> </ul> {{ Form::close() }} 

I see one _token question related to the issue on the forum, but that didn't help me.

Thank you in advance:)

+6
source share
1 answer

In fact, your error is MassAssignmentException , which means that you are using

 Model::create($input); 

In your controller and not using

 protected $fillable = array('columnA', 'name'...); 

or

 protected $guarded = array(); 

In your model, tell Laravel which fields in your table can be assigned to the mass.

Take a look at the docs: http://laravel.com/docs/eloquent#mass-assignment

+17
source

All Articles