diff --git a/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php b/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php index 8a407b7bc7a2..9e413f10fdc0 100644 --- a/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php +++ b/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php @@ -56,6 +56,8 @@ protected function initializeRequest(FormRequest $form, Request $current) $current->cookies->all(), $files, $current->server->all(), $current->getContent() ); + $form->setJson($current->json()); + if ($session = $current->getSession()) { $form->setLaravelSession($session); } diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index 6795cab7aea0..a1e7d0247f43 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -302,6 +302,17 @@ public function json($key = null, $default = null) return data_get($this->json->all(), $key, $default); } + /** + * Set the JSON payload for the request. + * + * @param array $json + * @return void + */ + public function setJson($json) + { + $this->json = $json; + } + /** * Get the input source for the request. *