Default Validator target to Input data.

This commit is contained in:
Taylor Otwell 2011-06-30 13:36:39 -07:00
parent 21f33bb46d
commit cbf2399ab8
1 changed files with 7 additions and 2 deletions

View File

@ -29,10 +29,15 @@ class Validator {
* @param mixed $target * @param mixed $target
* @return void * @return void
*/ */
public function __construct($target = array()) public function __construct($target = null)
{ {
$this->errors = new Validation\Error_Collector; $this->errors = new Validation\Error_Collector;
if (is_null($target))
{
$target = Input::get();
}
// --------------------------------------------------------- // ---------------------------------------------------------
// If the source is an Eloquent model, use the model's // If the source is an Eloquent model, use the model's
// attributes as the validation attributes. // attributes as the validation attributes.
@ -46,7 +51,7 @@ public function __construct($target = array())
* @param mixed $target * @param mixed $target
* @return Validator * @return Validator
*/ */
public static function make($target = array()) public static function make($target = null)
{ {
return new static($target); return new static($target);
} }