[李景山php]每天laravel-20161005|Validator.php-5

    /**
     * Validate that an attribute exists when any other attribute exists.
     *
     * @param  string  $attribute
     * @param  mixed   $value
     * @param  mixed   $parameters
     * @return bool
     */
    protected function validateRequiredWith($attribute, $value, $parameters)
    {
        if (! $this->allFailingRequired($parameters)) {// if all of them just be require
            return $this->validateRequired($attribute, $value);// return a validateRequired
        }//something is wrong

        return true;
    }//validate that an attribute exists when any other attribute exists

    /**
     * Validate that an attribute exists when all other attributes exists.
     *
     * @param  string  $attribute
     * @param  mixed   $value
     * @param  mixed   $parameters
     * @return bool
     */
    protected function validateRequiredWithAll($attribute, $value, $parameters)
    {
        if (! $this->anyFailingRequired($parameters)) {
            return $this->validateRequired($attribute, $value);
        }// validaterequired

        return true;
    }// too simple in this function

    /**
     * Validate that an attribute exists when another attribute does not.
     *
     * @param  string  $attribute
     * @param  mixed   $value
     * @param  mixed   $parameters
     * @return bool
     */
    protected function validateRequiredWithout($attribute, $value, $parameters)
    {
        if ($this->anyFailingRequired($parameters)) {
            return $this->validateRequired($attribute, $value);
        }

        return true;
    }//Validate that an attribute exists when another attribute does not.

    /**
     * Validate that an attribute exists when all other attributes do not.
     *
     * @param  string  $attribute
     * @param  mixed   $value
     * @param  mixed   $parameters
     * @return bool
     */
    protected function validateRequiredWithoutAll($attribute, $value, $parameters)
    {
        if ($this->allFailingRequired($parameters)) {
            return $this->validateRequired($attribute, $value);
        }

        return true;
    }//validate that an attribute exists when all other attributes do not

    /**
     * Validate that an attribute exists when another attribute has a given value.
     *
     * @param  string  $attribute
     * @param  mixed   $value
     * @param  mixed   $parameters
     * @return bool
     */
    protected function validateRequiredIf($attribute, $value, $parameters)
    {//Validate that an attribute exists when another attribute has a given value.
        $this->requireParameterCount(2, $parameters, ‘required_if‘);// a user function

        $data = Arr::get($this->data, $parameters[0]);// all of this arr::get

        $values = array_slice($parameters, 1);// use this sys function to get this value
       // just like get the other array about use this function that is array_pop

        if (in_array($data, $values)) {
            return $this->validateRequired($attribute, $value);
        }// if this value in this value

        return true;// default just a true return
    }

    /**
     * Validate that an attribute exists when another attribute does not have a given value.
     *
     * @param  string  $attribute
     * @param  mixed  $value
     * @param  mixed  $parameters
     * @return bool
     */
    protected function validateRequiredUnless($attribute, $value, $parameters)
    {//validate that an attribute exists when another attribute does not have a given value
        $this->requireParameterCount(2, $parameters, ‘required_unless‘);
// get parameter Count number , that is a user function
        $data = Arr::get($this->data, $parameters[0]);// just get this array value use the key

        $values = array_slice($parameters, 1);// get other collection

        if (! in_array($data, $values)) {// if in the data
            return $this->validateRequired($attribute, $value);
        }//determine it is right

        return true;//default it is true
    }

    /**
     * Get the number of attributes in a list that are present.
     *
     * @param  array  $attributes
     * @return int
     */
    protected function getPresentCount($attributes)
    {// function name that is get Present Count
        $count = 0;// set the default number

        foreach ($attributes as $key) {// loop this attribute
            if (Arr::get($this->data, $key) || Arr::get($this->files, $key)) {
                $count++;
            }// if it is can get something by data or bay files ,return count++
        }

        return $count;
    }// get the number in this list now

    /**
     * Validate that an attribute has a matching confirmation.
     *
     * @param  string  $attribute
     * @param  mixed   $value
     * @return bool
     */
    protected function validateConfirmed($attribute, $value)
    {// first this just a wrap
        return $this->validateSame($attribute, $value, [$attribute.‘_confirmation‘]);
       // validate Same has three parameters
    }//validate that an attribute has a matching confirmation

    /**
     * Validate that two attributes match.
     *
     * @param  string  $attribute
     * @param  mixed   $value
     * @param  array   $parameters
     * @return bool
     */
    protected function validateSame($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, ‘same‘);//require ParameterCount

        $other = Arr::get($this->data, $parameters[0]);// Arr::get

        return isset($other) && $value === $other;//return it is other
    }//validate that two attributes match
时间: 2024-08-27 19:03:17

[李景山php]每天laravel-20161005|Validator.php-5的相关文章

[李景山php]每天laravel-20161004|Validator.php-4

   /**     * Determine if it's a necessary presence validation.     *     * This is to avoid possible database type comparison errors.     *     * @param  string  $rule     * @param  string  $attribute     * @return bool     */    protected function 

[李景山php]每天laravel-20161014|Validator.php-14

    //2016-08-16     /**      * Parse a parameter list.      *      * @param  string  $rule      * @param  string  $parameter      * @return array      */     protected function parseParameters($rule, $parameter)     {//Parse a parameter list        

[李景山php]每天laravel-20161009|Validator.php-9

    /**      * Get the excluded ID column and value for the unique rule.      *      * @param  array  $parameters      * @return array      */     protected function getUniqueIds($parameters)     {         $idColumn = isset($parameters[3]) ? $paramet

[李景山php]每天laravel-20161010|Validator.php-10

   /**     * Validate the guessed extension of a file upload is in a set of file extensions.     *     * @param  string  $attribute     * @param  mixed  $value     * @param  array   $parameters     * @return bool     */    protected function validate

[李景山php]每天laravel-20161011|Validator.php-11

/**  * Given two date/time strings, check that one is after the other.  *  * @param  string  $format  * @param  string  $before  * @param  string  $after  * @return bool  */ protected function checkDateTimeOrder($format, $before, $after) {     $befor

[李景山php]每天laravel-20161003|Validator.php-3

   /**     * Validate a given attribute against a rule.     *     * @param  string  $attribute     * @param  string  $rule     * @return void     */    protected function validate($attribute, $rule)    {// validate a given attribute against a rule.  

[李景山php]每天laravel-20161012|Validator.php-12

/**  * Get the inline message for a rule if it exists.  *  * @param  string  $attribute  * @param  string  $lowerRule  * @param  array   $source  * @return string|null  */ protected function getInlineMessage($attribute, $lowerRule, $source = null) {/

[李景山php]每天laravel-20161006|Validator.php-6

   /**     * Validate that an attribute is different from another attribute.     *     * @param  string  $attribute     * @param  mixed   $value     * @param  array   $parameters     * @return bool     */    protected function validateDifferent($attr

[李景山php]每天laravel-20160920|Writer-2

    //2016-07-20     /**      * Register a file log handler.      *      * @param  string  $path      * @param  string  $level      * @return void      */     public function useFiles($path, $level = 'debug')     {         $this->monolog->pushHandle