Merge branch 'develop'
This commit is contained in:
commit
9dbcca0e39
|
@ -88,6 +88,17 @@ private static function get_rangable_message($rule)
|
||||||
*/
|
*/
|
||||||
private static function get_upload_of_message($rule)
|
private static function get_upload_of_message($rule)
|
||||||
{
|
{
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
// Upload_Of rules sometimes set a "presence_of" error.
|
||||||
|
//
|
||||||
|
// This occurs when the uploaded file didn't exist and the
|
||||||
|
// "not_required" method was not called.
|
||||||
|
// ---------------------------------------------------------
|
||||||
|
if ($rule->error == 'presence_of')
|
||||||
|
{
|
||||||
|
return static::get_message($rule);
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// Slice "file_" off of the error type.
|
// Slice "file_" off of the error type.
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue