结帐产品增值税ValidationExtensionS服务提供商'未找到

时间:2015-09-18 07:59:51

标签: php laravel-4 custom-validators

我在结帐产品增值税验证时遇到自定义验证问题。

但我正在运行此错误:

  

找不到类'App \ Providers \ ValidationExtensionS服务提供商'。

任何人都可以帮我解决这个问题。

我在这里附上了我的valadatorextended.php文件:

namespace App\Services;
use App\Services\ValidatorExtended;
use Illuminate\Support\ServiceProvider;
use Illuminate\Validation\Validator as IlluminateValidator;
class ValidatorExtended extends IlluminateValidator {
private $_custom_messages = array(
   "vat" => "The :attribute is not a valid VAT.",
   //place for more customized messages
);
public function __construct( $translator, $data, $rules, $messages = array(), $customAttributes = array() ) {
parent::__construct( $translator, $data, $rules, $messages, $customAttributes );

 $this->_set_custom_stuff();
}

protected function _set_custom_stuff() {
   //setup our custom error messages
   $this->setCustomMessages( $this->_custom_messages );
}

protected function validateVat( $attribute, $value ) {
   // You can extend your RegEx with other Countries, if you like

   return (bool) preg_match( "/((DK|FI|HU|LU|MT|SI)(-)?\d{8})|((BE|EE|DE|EL|LT|PT)(-)?\d{9})|((PL|SK)(-)?\d{10})|((IT|LV)(-)?\d{11})|((LT|SE)(-)?\d{12})|(AT(-)?U\d{8})|(CY(-)?\d{8}[A-Z])|(CZ(-)?\d{8,10})|(FR(-)?[\dA-HJ-NP-Z]{2}\d{9})|(IE(-)?\d[A-Z\d]\d{5}[A-Z])|(NL(-)?\d{9}B\d{2})|(ES(-)?[A-Z\d]\d{7}[A-Z\d])/", $value );
  }

   //place for more protected functions for other custom validations

  }

1 个答案:

答案 0 :(得分:0)

看起来你已经搞砸了某个地方的public void close() throws IOException { try { clip.close(); } catch (IOException e) { e.printStackTrace(); } try { audioIn.close(); } catch (IOException e) { e.printStackTrace(); } } 声明。如果您尝试使用Use类,则ValidatorExtended语句应如下所示:

use

看一下,你提供的代码似乎并不适合给出的错误。