By John Koster
The method_field helper function is a simple function that returns a new instance of "Illuminate\Support\HtmlString" The contents of the HtmlString instance is a hidden HTML input field with the name _method and the a value of $method.
#Signature
The signature of the method_field function is:
1function method_field(
2 $method
3);
#Example Use
The following example highlights the results of the method_field function:
1method_field('PUT');
2method_field('POST');
3method_field('GET');
4method_field('PATCH');
5method_field('DELETE');
The return value of the method_field function is an instance of HtmlString. The corresponding HTML string value for each function call above would be:
1<input type="hidden" name="_method" value="PUT">
2<input type="hidden" name="_method" value="POST">
3<input type="hidden" name="_method" value="GET">
4<input type="hidden" name="_method" value="PATCH">
5<input type="hidden" name="_method" value="DELETE">
∎