当前位置: 首页>>代码示例>>PHP>>正文


PHP Validator::fails方法代码示例

本文整理汇总了PHP中Illuminate\Validation\Validator::fails方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::fails方法的具体用法?PHP Validator::fails怎么用?PHP Validator::fails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Validation\Validator的用法示例。


在下文中一共展示了Validator::fails方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate

 /**
  * Validate the form data
  *
  * @param array $formData
  * @param null $id
  * @throws \BB\Exceptions\FormValidationException
  * @return boolean
  */
 public function validate(array $formData, $id = null)
 {
     $this->validation = $this->validator->make($formData, $this->getValidationRules(['id' => $id]));
     if ($this->validation->fails()) {
         throw new FormValidationException('Validation failed', $this->getValidationErrors());
     }
     return true;
 }
开发者ID:adamstrawson,项目名称:BBMembershipSystem,代码行数:16,代码来源:FormValidator.php

示例2: validate

 /**
  * Validate the form data
  *
  * @param array $data
  *
  * @return mixed
  * @throws ValidationException
  */
 public function validate(array $data)
 {
     $this->validation = $this->validator->make($data, $this->getValidationRules(), $this->getValidationMessages());
     if ($this->validation->fails()) {
         throw new ValidationException('Validation failed', $this->getValidationErrors());
     }
     return true;
 }
开发者ID:xintang22,项目名称:Paxifi,代码行数:16,代码来源:Validator.php

示例3: validate

 /**
  * Validate the given data.
  *
  * @param array $data
  * @return bool
  * @throws ValidationException
  */
 public function validate(array $data = null)
 {
     $data = $data ?: $this->getInput();
     $this->validation = $this->validator->make($data, $this->rules(), $this->messages());
     if ($this->validation->fails()) {
         $this->failed();
     }
     return true;
 }
开发者ID:arwinjp,项目名称:ODTS,代码行数:16,代码来源:Validator.php

示例4: validate

 /**
  * @param array $formData
  *
  * @throws FormValidationException
  */
 public function validate(array $formData)
 {
     // Instantiate validator instance by factory
     $this->validation = $this->validator->make($formData, $this->rules());
     // Validate
     if ($this->validation->fails()) {
         throw new FormValidationException('Validation Failed', $this->getValidationErrors());
     }
     return true;
 }
开发者ID:khoilv,项目名称:cuongthuy,代码行数:15,代码来源:BaseForm.php

示例5: validate

 public function validate()
 {
     $data = $this->toArray();
     $this->validator = Validator::make($data, $this->getSingleValidator());
     $result = !$this->validator->fails();
     $this->failed = $this->validator->failed();
     foreach ($this->getAllValidators() as $key => $validate) {
         $validator = Validator::make($data[$key], $validate->getSingleValidator());
         $result = !$validator->fails() && $result;
         if ($validator->fails()) {
             $this->failed = array_merge($this->failed, [$key => $validator->failed()]);
         }
     }
     return $result;
 }
开发者ID:agustincarmona,项目名称:laravel-api-restful-schema,代码行数:15,代码来源:PropertyBagValidate.php

示例6: validate

 public function validate(\Illuminate\Validation\Validator $validator)
 {
     if ($validator->fails()) {
         $this->validation_errors = $validator->messages();
         return false;
     }
     return true;
 }
开发者ID:fredlawl,项目名称:planebox-api,代码行数:8,代码来源:PlaneBoxModel.php

示例7: validateOrFail

 public function validateOrFail($additional = array())
 {
     $attributes = $this->getAttributes();
     $this->validator = \Validator::make($attributes, $this->prepareRules());
     if ($this->validator->fails()) {
         $messages = $this->validator->messages();
         foreach ($attributes as $key => $value) {
             if ($messages->has($key)) {
                 foreach ($messages->get($key) as $message) {
                     $additional['attribute'] = $key;
                     $this->errors->add(new Error($message, '', $additional));
                 }
             }
         }
         throw new ValidationException($this->errors->errors());
     }
     return true;
 }
开发者ID:AniartUA,项目名称:crm,代码行数:18,代码来源:BaseModel.php

示例8: validate

 /**
  * Validate data.
  *
  * @author Morten Rugaard <moru@nodes.dk>
  *
  * @return bool
  * @throws \Nodes\Validation\Exceptions\ValidationException
  */
 public function validate()
 {
     // Generate validator instance
     $this->validator = $this->validatorFactory->make($this->getData(), $this->getRules(), $this->getMessages(), $this->getAttributes());
     // Validation was a success!
     if (!$this->validator->fails()) {
         return true;
     }
     // Collect validation errors
     $this->errors = $this->validator->messages();
     return false;
 }
开发者ID:nodes-php,项目名称:validation,代码行数:20,代码来源:AbstractValidator.php

示例9: validateData

 /**
  * Validates the supplied data against the options rules
  *
  * @param array		$data
  * @param array		$rules
  * @param array		$messages
  *
  * @param mixed
  */
 public function validateData(array $data, array $rules, array $messages)
 {
     if ($rules) {
         $this->customValidator->setData($data);
         $this->customValidator->setRules($rules);
         $this->customValidator->setCustomMessages($messages);
         //if the validator fails, kick back the errors
         if ($this->customValidator->fails()) {
             return implode('. ', $this->customValidator->messages()->all());
         }
     }
     return true;
 }
开发者ID:dmitriyuch,项目名称:Laravel-Administrator,代码行数:22,代码来源:Config.php

示例10: fails

 /**
  * {@inheritDoc}
  */
 public function fails()
 {
     return $this->validator->fails();
 }
开发者ID:bratter,项目名称:petal,代码行数:7,代码来源:Result.php

示例11: __construct

 public function __construct(Validator $validator)
 {
     if ($validator->fails()) {
         parent::__construct(json_encode($validator->errors()->getMessages()));
     }
 }
开发者ID:AudithSoftworks,项目名称:Basis-API,代码行数:6,代码来源:ValidationException.php


注:本文中的Illuminate\Validation\Validator::fails方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。