Please correct me if I'm wrong with anything written below but ...
I think it is impossible to add custom validation rules when using laracasts/validation.
class LaravelValidator implements FactoryInterface {
// ...
/**
* @param Validator $validator
*/
function __construct(Validator $validator)
{
$this->validator = $validator;
}
// ...
- You are type hinting
Laravel's Validator here which results in a new instance
Validator::extend() wont extend laracasts/validation's instance of Validator
LaravelValidator is missing an extend() method to get around this
I don't think that I'm doing something wrong because my custom validation rule is working if I do the following in php artisan tinker:
$validator = Validator::make(['test' => 'foo'], ['test' => 'bar']);
$validator->fails();
Is there any other way to extend it easily that I missed? If so an update to the docs would be awesome.
Please correct me if I'm wrong with anything written below but ...
I think it is impossible to add custom validation rules when using laracasts/validation.
Laravel's Validatorhere which results in a new instanceValidator::extend()wont extendlaracasts/validation's instance of ValidatorLaravelValidatoris missing anextend()method to get around thisI don't think that I'm doing something wrong because my custom validation rule is working if I do the following in
php artisan tinker:Is there any other way to extend it easily that I missed? If so an update to the docs would be awesome.