fix some input stuff and revert paginator changes.

This commit is contained in:
Taylor Otwell 2012-03-28 23:56:20 -05:00
parent 77fe8b6706
commit 9e8acd1eda
2 changed files with 33 additions and 4 deletions

View File

@ -16,7 +16,7 @@ class Input {
*/
public static function all()
{
$input = array_merge(static::get(), static::query(), $_FILES);
$input = array_merge(static::get(), static::query(), static::file());
unset($input[Request::spoofer]);
@ -55,7 +55,14 @@ public static function has($key)
*/
public static function get($key = null, $default = null)
{
return array_get(Request::foundation()->request->all(), $key, $default);
$value = Request::foundation()->request->get($key);
if (is_null($value))
{
return array_get(static::query(), $key, $default);
}
return $value;
}
/**
@ -161,7 +168,29 @@ public static function old($key = null, $default = null)
*/
public static function file($key = null, $default = null)
{
return array_get(Request::foundation()->files->all(), $key, $default);
return array_get($_FILES, $key, $default);
}
/**
* Move an uploaded file to permanent storage.
*
* This method is simply a convenient wrapper around move_uploaded_file.
*
* <code>
* // Move the "picture" file to a new permanent location on disk
* Input::upload('picture', 'path/to/photos', 'picture.jpg');
* </code>
*
* @param string $key
* @param string $directory
* @param string $name
* @return bool
*/
public static function upload($key, $directory, $name = null)
{
if (is_null(static::file($key))) return false;
return Request::foundation()->files->get($key)->move($directory, $name);
}
/**

View File

@ -112,7 +112,7 @@ public static function make($results, $total, $per_page)
*/
public static function page($total, $per_page)
{
$page = Input::query('page', 1);
$page = Input::get('page', 1);
// The page will be validated and adjusted if it is less than one or greater
// than the last page. For example, if the current page is not an integer or