- Laravel Version: 5.6.14
- PHP Version: 7.2.3
- Database Driver & Version: MariaDB 10.2.14
Description:
It only works when combined with single built-in rule. Trying to use chained rules throws an error.
Steps To Reproduce:
This works:
$request->validate([
'name' => 'string|max:255',
]);
And this works as well:
use App\Rules\CustomValidationRule;
$request->validate([
'name' => ['string', new CustomValidationRule],
]);
But this fails:
use App\Rules\CustomValidationRule;
$request->validate([
'name' => ['string|max:255', new CustomValidationRule],
]);
and throws an error:
message: Method Illuminate\Validation\Validator::validateString|max does not exist.
exception: BadMethodCallException
file: vendor/laravel/framework/src/Illuminate/Validation/Validator.php
line: 1146