Browse Source

Merge pull request #821 from daylerees/feature/clear-input

Added clear() method to the input class
Taylor Otwell 12 years ago
parent
commit
fc96014c4f
2 changed files with 16 additions and 1 deletions
  1. 7 1
      laravel/documentation/input.md
  2. 9 0
      laravel/input.php

+ 7 - 1
laravel/documentation/input.md

@@ -145,4 +145,10 @@ Sometimes you may wish to merge or replace the current input. Here's how:
 
 #### Replacing the entire input array with new data:
 
-	Input::merge(array('doctor' => 'Bones', 'captain' => 'Kirk'));
+	Input::merge(array('doctor' => 'Bones', 'captain' => 'Kirk'));
+
+## Clearing Input
+
+To clear all input data for the current request, using the `clear()` method, for example:
+
+	Input::clear();

+ 9 - 0
laravel/input.php

@@ -287,4 +287,13 @@ class Input {
 		Request::foundation()->request->replace($input);
 	}
 
+	/**
+	 * Clear the input for the current request.
+	 * @return void
+	 */
+	public static function clear()
+	{
+		Request::foundation()->request->replace(array());
+	}
+
 }