diff --git a/FormBuilder.php b/FormBuilder.php index 2792817..79c5723 100644 --- a/FormBuilder.php +++ b/FormBuilder.php @@ -705,14 +705,25 @@ class FormBuilder { */ protected function getAppendage($method) { - $method = strtoupper($method); + list($method, $appendage) = array(strtoupper($method), ''); + // If the HTTP method is in this list of spoofed methods, we will attach the + // method spoofer hidden input to the form. This allows us to use regular + // form to initiate PUT and DELETE requests in addition to the typical. if (in_array($method, $this->spoofedMethods)) { - return $this->hidden('_method', $method); + $appendage .= $this->hidden('_method', $method); } - return ''; + // If the method is something other than GET we will go ahead and attach the + // CSRF token to the form, as this can't hurt and is convenient to simply + // always have available on every form the developers creates for them. + if ($method != 'GET') + { + $appendage .= $this->token(); + } + + return $appendage; } /**