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


PHP Validator::fails方法代码示例

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


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

示例1: messages

 /**
  * Returns validation errors, if any
  *
  * @return MessageBag
  */
 public function messages()
 {
     if (is_null($this->validator)) {
         $this->validate();
     }
     if (!$this->validator->fails()) {
         return App::make(MessageBag::class);
     }
     return $this->validator->messages();
 }
开发者ID:pixelindustries,项目名称:extended-validators,代码行数:15,代码来源:ValidatableTrait.php

示例2: messages

 /**
  * Returns validation errors, if any
  *
  * @return \Illuminate\Contracts\Support\MessageBag
  */
 public function messages()
 {
     if (is_null($this->validator)) {
         $this->validate();
     }
     if (!$this->validator->fails()) {
         return app('\\Illuminate\\Support\\Messagebag');
     }
     return $this->validator->messages();
 }
开发者ID:czim,项目名称:laravel-dataobject,代码行数:15,代码来源:ValidatableTrait.php

示例3: validate

 public function validate()
 {
     if ($this->validator->fails()) {
         $messages = [];
         foreach ($this->validator->messages()->all("The :key variable is not defined or invalid") as $var => $message) {
             $messages[] = $message;
         }
         $msg = 'The .env file has some problems. Please check config/laravel-env-validator.php' . PHP_EOL . implode(PHP_EOL, $messages);
         throw new Exception($msg);
     }
 }
开发者ID:mathiasgrimm,项目名称:laravel-env-validator,代码行数:11,代码来源:EnvValidator.php

示例4: fails

 /**
  * Does validation fails with given data
  *
  * @return bool
  * @throws \Exception
  */
 public function fails()
 {
     if (is_null($this->validated)) {
         throw new \Exception("No data has been validated yet");
     }
     return $this->validated->fails();
 }
开发者ID:laratalks,项目名称:validator,代码行数:13,代码来源:AbstractValidator.php

示例5: isValid

 /**
  * Check if the form is valid
  *
  * @return bool
  */
 public function isValid()
 {
     if (!$this->validator) {
         $this->validate();
     }
     return !$this->validator->fails();
 }
开发者ID:pnagaraju25,项目名称:laravel-form-builder,代码行数:12,代码来源:Form.php

示例6: validateWith

 /**
  * Run the validation routine against the given validator.
  *
  * @param  \Illuminate\Contracts\Validation\Validator  $validator
  * @param  \Illuminate\Http\Request|null  $request
  * @return void
  */
 public function validateWith($validator, Request $request = null)
 {
     $request = $request ?: app('request');
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
 }
开发者ID:dbwhddn10,项目名称:framework,代码行数:14,代码来源:ValidatesRequests.php


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