继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

Validator.php-6

一只斗牛犬
关注TA
已关注
手记 528
粉丝 49
获赞 300

 /**

    * 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!

打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP