e.herrera e.herrera - 7 months ago 33
PHP Question

Could anybody point out why do I get TokenMismatchException when trying to submit the form?

How can I place a token in laravel, I am getting a token error? Thank you for your collaboration.

enter image description here


I'm guessing the reason way Jeffery's code works is because the version of Laravel doesn't have default csrf protection, so if u want to make your form works, you have to manually add :

<input type="hidden" name="_token" value="{{ csrf_token() }}">

or create the form with the form helper:

{{ Form::open(array('url' => 'foo/bar')) }}
{{ Form::close() }}

which will automatically generate the hidden input tag of csrf token