From a9760ecdbed27778263ce4c0cc6381e7cac4a043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20M?= Date: Wed, 28 Nov 2012 20:48:14 +0100 Subject: [PATCH] Added the possibility to pass the parameter of JSON options like JSON_PRETTY_PRINT or JSON_UNESCAPED_UNICODE to the Response::json method. --- laravel/response.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/laravel/response.php b/laravel/response.php index ccd53e1f..98ec63d7 100644 --- a/laravel/response.php +++ b/laravel/response.php @@ -89,14 +89,16 @@ public static function view($view, $data = array()) * @param mixed $data * @param int $status * @param array $headers + * @param int $json_options * @return Response */ - public static function json($data, $status = 200, $headers = array()) + public static function json($data, $status = 200, $headers = array(), $json_options = 0) { $headers['Content-Type'] = 'application/json; charset=utf-8'; - return new static(json_encode($data), $status, $headers); + return new static(json_encode($data, $json_options), $status, $headers); } + /** * Create a new response of JSON'd Eloquent models.