Generating a Hidden Field With the CSRF Token

Problem

You want to output the CSRF token yourself.

You know Laravel does this automatically with Form::open() or Form::model() but you want to do it yourself.

Solution

Use the Form::token() method.

{{ Form::token() }}

This will output something like.

<input name="_token" type="hidden" value="somelongvalue">

Discussion

Nothing to discuss.

comments powered by Disqus