fix bugs in input class.

This commit is contained in:
Taylor Otwell 2012-04-24 08:37:37 -05:00
parent 3241de0cc1
commit 39601e8a78
2 changed files with 24 additions and 1 deletions

View File

@ -55,6 +55,7 @@ ## Laravel 3.2
- 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

View File

@ -55,7 +55,14 @@ public static function has($key)
*/
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 @@ public static function get($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);
}
@ -151,6 +163,11 @@ public static function had($key)
*/
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 @@ public static function old($key = null, $default = null)
*/
public static function file($key = null, $default = null)
{
if (is_null($key))
{
return $_FILES;
}
return array_get($_FILES, $key, $default);
}