我在结帐产品增值税验证时面临自定义验证的问题。
但是我正在运行这个错误:
有谁能帮我解决这个问题吗?类"App'Providers'ValidationExtensionS Service Provider"未找到。
我把valadatoreextend。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
}
看起来你在某个地方搞砸了你的Use
语句。如果您尝试使用ValidatorExtended
类,您的use
语句应该看起来像:
use App'Services'ValidatorExtended;
看它,你提供的代码似乎不适合给出的错误。