Home > Software engineering >  Numeric|max Throws Bad Method Call Exception
Numeric|max Throws Bad Method Call Exception

Time:06-21

I'm recieving the following error from the from request class in Laravel.

BadMethodCallException: Method Illuminate\Validation\Validator::validateNumeric|max does not exist.
in /var/www/html/vendor/laravel/framework/src/Illuminate/Validation/Validator.php:1532

This is my validation rule:

['required', 'integer', 'numeric|max:90', new UniqueWhenNew]

The value I passed is 70.

Apperantly, this is a strange situation because I didn't find anything similar on Google.

I hope someone knows what is the issue. Thanks in advance.

CodePudding user response:

You can either use all rules in string or array.

$rules = ['required', 'integer', 'numeric', 'max:90', new UniqueWhenNew]
  • Related