Skip to content

Conversation

@saaiful
Copy link
Contributor

@saaiful saaiful commented Mar 12, 2015

csrf_form() will return csrf token value wrapped with hidden input.
in php call echo csrf_form(); and in blade {!! csrf_form() !!}

csrf_form() will return csrf token value wrapped with hidden input.
in php call echo csrf_form(); and in blade {!! csrf_form() !!}
@ghost
Copy link

ghost commented Mar 12, 2015

Seems odd to name it csrf_form(), it implies to me it'll return a form element due to the name. Not a bad idea though, it doesn't add a ton of new helpers (which I believe is the cause of a lot of helper PRs being closed) and it's actually useful.

@JoostK
Copy link
Contributor

JoostK commented Mar 12, 2015

Nothing wrong with using <input type="hidden" name="_token" value="{{ csrf_token() }}">

@JosephSilber
Copy link
Contributor

If you need this sort of thing, use the html/form package:

{!! Form::token() !!}

https://github.com/LaravelCollective/html/blob/5.0/src/FormBuilder.php#L175-L185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants