-1

I am running a laravel 4 framework and I get a Whoops! error with just the message "_token" when I try to update an instance of an eloquent model class. What does this mean? I use Form::model to create the form and I am able to update records of other model classes.

Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204

2 Answers2

0

This is usually a result of either a missing or mismatched CSRF token. If you haven't placed a token in your form, do so by echoing the function 'Form::token()' somewhere inside your form. Otherwise I believe this is handled for you if you use the 'Form::open()' syntax to open your form. You can learn more about it here: http://laravel.com/docs/html#csrf-protection

The token is stored as part of the user's session, btw, so it's possible you can get a token mismatch error if you store your sessions in the database, then wipe the database in between getting a form and posting it.

John
  • 2,894
  • 2
  • 20
  • 25
0

If I am not mistaken, token is automaticly added when you use Form::open / Form::model. In this case you are probally missing array $fillable/$guarded in your model.

You can read more about this here: http://laravel.com/docs/4.2/eloquent#mass-assignment

Sigismund
  • 1,053
  • 9
  • 21