Browse Source

Merge pull request #1186 from akuzemchak/feature/json

Allow Input::json() to return array instead of object
Taylor Otwell 12 years ago
parent
commit
96f428f83c
1 changed files with 3 additions and 2 deletions
  1. 3 2
      laravel/input.php

+ 3 - 2
laravel/input.php

@@ -102,13 +102,14 @@ class Input {
 	/**
 	 * Get the JSON payload for the request.
 	 *
+	 * @param  bool    $as_array
 	 * @return object
 	 */
-	public static function json()
+	public static function json($as_array = false)
 	{
 		if ( ! is_null(static::$json)) return static::$json;
 
-		return static::$json = json_decode(Request::foundation()->getContent());
+		return static::$json = json_decode(Request::foundation()->getContent(), $as_array);
 	}
 
 	/**