laracasts / Validation

Easy form validation.
https://packagist.org/packages/laracasts/validation
MIT License
150 stars 37 forks source link

Custom Validation Rules #15

Open hettiger opened 10 years ago

hettiger commented 10 years ago

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;
    }

    // ...

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.

lijinma commented 9 years ago

I got the same issue and have no clue.

lijinma commented 9 years ago

I am using Regex:/^$/i rule as a workaround.