码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2016-08-05 12:10:07      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:different   function   another   require   return   

   /**
    * Validate that an attribute is different from another attribute.
    *
    * @param  string  $attribute
    * @param  mixed   $value
    * @param  array   $parameters
    * @return bool
    */
   protected function validateDifferent($attribute, $value, $parameters)
   {
       $this->requireParameterCount(1, $parameters, ‘different‘);// require Parameter Count

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

       return isset($other) && $value !== $other;//return value
   }// Validate that an attribute is different from another attribute

   /**
    * Validate that an attribute was "accepted".
    *
    * This validation rule implies the attribute is "required".
    *
    * @param  string  $attribute
    * @param  mixed   $value
    * @return bool
    */
   protected function validateAccepted($attribute, $value)
   {
       $acceptable = [‘yes‘, ‘on‘, ‘1‘, 1, true, ‘true‘];

       return $this->validateRequired($attribute, $value) && in_array($value, $acceptable, true);
   }//Validate that an attribute was "accepted"
// change every thing it is ok!


本文出自 “专注php” 博客,请务必保留此出处http://jingshanls.blog.51cto.com/3357095/1834605

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

标签:different   function   another   require   return   

原文地址:http://jingshanls.blog.51cto.com/3357095/1834605

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!