Browse Source

fix bugs in input class.

Taylor Otwell 12 years ago
parent
commit
39601e8a78
2 changed files with 24 additions and 1 deletions
  1. 1 0
      laravel/documentation/changes.md
  2. 23 1
      laravel/input.php

+ 1 - 0
laravel/documentation/changes.md

@@ -55,6 +55,7 @@
 - Added `Request::set_env` method.
 - `Schema::drop` now accepts `$connection` as second parameter.
 - Added `Input::merge` method.
+- Added `Input::replace` method.
 
 <a name="upgrade-3.2"></a>
 ## Upgrading From 3.1

+ 23 - 1
laravel/input.php

@@ -55,7 +55,14 @@ class Input {
 	 */
 	public static function get($key = null, $default = null)
 	{
-		$value = array_get(Request::foundation()->request->all(), $key);
+		$input = Request::foundation()->request->all();
+
+		if (is_null($key))
+		{
+			return array_merge($input, static::query());
+		}
+
+		$value = array_get($input, $key);
 
 		if (is_null($value))
 		{
@@ -82,6 +89,11 @@ class Input {
 	 */
 	public static function query($key = null, $default = null)
 	{
+		if (is_null($key))
+		{
+			return Request::foundation()->query->all();
+		}
+
 		return array_get(Request::foundation()->query->all(), $key, $default);
 	}
 
@@ -151,6 +163,11 @@ class Input {
 	 */
 	public static function old($key = null, $default = null)
 	{
+		if (is_null($key))
+		{
+			return Session::get(Input::old_input, array());
+		}
+
 		return array_get(Session::get(Input::old_input, array()), $key, $default);
 	}
 
@@ -168,6 +185,11 @@ class Input {
 	 */
 	public static function file($key = null, $default = null)
 	{
+		if (is_null($key))
+		{
+			return $_FILES;
+		}
+
 		return array_get($_FILES, $key, $default);
 	}