clamav-validator icon indicating copy to clipboard operation
clamav-validator copied to clipboard

Method Sunspikes\ClamavValidator\ClamavValidator::validateColorHex does not exist.

Open SamuelWei opened this issue 3 years ago • 4 comments

Just like in #19 I have trouble using this extension. If used with for example this extension https://github.com/Kaishiyoku/laravel-color-validation and the form validation rule is just ['required', 'color_hex'] I get the following error:

BadMethodCallException
Method Sunspikes\ClamavValidator\ClamavValidator::validateColorHex does not exist.

SamuelWei avatar Nov 26 '20 09:11 SamuelWei

Having the same issue when I tried to create my own custom validation class using Validator::extend. The issue appears to be that clamav-validator is trying to resolve my custom validation method

https://github.com/sunspikes/clamav-validator/blob/d9d81af054a60fcde01cc3cbb02dd45e956627ff/src/ClamavValidator/ClamavValidatorServiceProvider.php#L42

TCURT15 avatar Dec 21 '20 19:12 TCURT15

Is there a solution to this, please?

AlexanderWright avatar Mar 12 '21 16:03 AlexanderWright

For others with this issue, I added the package to Laravel's dont-discover section in composer.json, then used the following just before the validation code:

    // Register the AV validator manually to avoid clash.
    app()->register(\Sunspikes\ClamavValidator\ClamavValidatorServiceProvider::class);

AlexanderWright avatar Mar 18 '21 08:03 AlexanderWright

Same issue, using it with https://github.com/Intervention/validation will override all validations.

@AlexanderWright hack works but isn't really a solution.

Also will probably fail once you try to use validations together from both packages.

reosch avatar Oct 26 '21 14:10 reosch