* // Get the "email" item from the input array * $email = Input::get('email'); * * // Return a default value if the specified item doesn't exist * $email = Input::get('name', 'Taylor'); * * * @param string $key * @param mixed $default * @return mixed */ public static function get($key = null, $default = null) { return Arr::get(static::$input, $key, $default); } /** * Determine if the old input data contains an item. * * @param string $key * @return bool */ public static function had($key) { return ( ! is_null(static::old($key)) and trim((string) static::old($key)) !== ''); } /** * Get input data from the previous request. * * * // Get the "email" item from the old input * $email = Input::old('email'); * * // Return a default value if the specified item doesn't exist * $email = Input::old('name', 'Taylor'); * * * @param string $key * @param mixed $default * @return string */ public static function old($key = null, $default = null) { if (Config::get('session.driver') == '') { throw new \Exception('A session driver must be specified in order to access old input.'); } return Arr::get(Session\Manager::$payload->get(Input::old_input, array()), $key, $default); } /** * Get an item from the uploaded file data. * * * // Get the array of information for the "picture" upload * $picture = Input::file('picture'); * * // Get a specific element from the file array * $size = Input::file('picture.size'); * * * @param string $key * @param mixed $default * @return array */ public static function file($key = null, $default = null) { return Arr::get($_FILES, $key, $default); } /** * Move an uploaded file to permanent storage. * * This method is simply a convenient wrapper around move_uploaded_file. * * * // Move the "picture" item from the $_FILES array to a permanent location * Input::upload('picture', 'path/to/storage/picture.jpg'); * * * @param string $key * @param string $path * @return bool */ public static function upload($key, $path) { return array_key_exists($key, $_FILES) ? File::upload($key, $path, $_FILES) : false; } }