Commit 39601e8a authored by Taylor Otwell's avatar Taylor Otwell

fix bugs in input class.

parent 3241de0c
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
- Added `Request::set_env` method. - Added `Request::set_env` method.
- `Schema::drop` now accepts `$connection` as second parameter. - `Schema::drop` now accepts `$connection` as second parameter.
- Added `Input::merge` method. - Added `Input::merge` method.
- Added `Input::replace` method.
<a name="upgrade-3.2"></a> <a name="upgrade-3.2"></a>
## Upgrading From 3.1 ## Upgrading From 3.1
......
...@@ -55,7 +55,14 @@ class Input { ...@@ -55,7 +55,14 @@ class Input {
*/ */
public static function get($key = null, $default = null) 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)) if (is_null($value))
{ {
...@@ -82,6 +89,11 @@ class Input { ...@@ -82,6 +89,11 @@ class Input {
*/ */
public static function query($key = null, $default = null) 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); return array_get(Request::foundation()->query->all(), $key, $default);
} }
...@@ -151,6 +163,11 @@ class Input { ...@@ -151,6 +163,11 @@ class Input {
*/ */
public static function old($key = null, $default = null) 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); return array_get(Session::get(Input::old_input, array()), $key, $default);
} }
...@@ -168,6 +185,11 @@ class Input { ...@@ -168,6 +185,11 @@ class Input {
*/ */
public static function file($key = null, $default = null) public static function file($key = null, $default = null)
{ {
if (is_null($key))
{
return $_FILES;
}
return array_get($_FILES, $key, $default); return array_get($_FILES, $key, $default);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment