use method directive

This commit is contained in:
Taylor Otwell 2018-01-26 10:08:09 -06:00
parent 14a15674a3
commit cb7b1ba8e4
2 changed files with 8 additions and 4 deletions

View File

@ -174,9 +174,11 @@ If you are using route model binding and would like the resource controller's me
#### Spoofing Form Methods
Since HTML forms can't make `PUT`, `PATCH`, or `DELETE` requests, you will need to add a hidden `_method` field to spoof these HTTP verbs. The `method_field` helper can create this field for you:
Since HTML forms can't make `PUT`, `PATCH`, or `DELETE` requests, you will need to add a hidden `_method` field to spoof these HTTP verbs. The `@method` Blade directive can create this field for you:
{{ method_field('PUT') }}
<form action="/foo/bar" method="POST">
@method('PUT')
</form>
<a name="restful-partial-resource-routes"></a>
### Partial Resource Routes

View File

@ -348,9 +348,11 @@ HTML forms do not support `PUT`, `PATCH` or `DELETE` actions. So, when defining
<input type="hidden" name="_token" value="{{ csrf_token() }}">
</form>
You may use the `method_field` helper to generate the `_method` input:
You may use the `@method` Blade directive to generate the `_method` input:
{{ method_field('PUT') }}
<form action="/foo/bar" method="POST">
@method('PUT')
</form>
<a name="accessing-the-current-route"></a>
## Accessing The Current Route