Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Allow subclass overriding of Validator #122

Merged
merged 1 commit into from
Nov 22, 2013

Conversation

claar
Copy link
Contributor

@claar claar commented Nov 1, 2013

I want to be able to use Laravel's Validator's sometimes() feature with Ardent:

$v = Validator::make(...);
$v->sometimes('reason', 'required|max:500', function($input)
{
    return $input->games >= 100;
});

Allowing subclass overriding of Ardent::makeValidator() seems the easiest way.

I want to be able to use Laravel's Validator's sometimes() feature with Ardent:

```
$v = Validator::make(...);
$v->sometimes('reason', 'required|max:500', function($input)
{
    return $input->games >= 100;
});
```

Allowing subclass overriding of Ardent::makeValidator() seems the easiest way.
@claar
Copy link
Contributor Author

claar commented Nov 1, 2013

Even better than this solution, perhaps, would be something like:

$this->validator = self::makeValidator($data, $rules, $customMessages);
$this->fireModelEvent('validator');
$success   = $this->validator->passes();

combined with a Ardent::getValidator() method.

@igorsantos07
Copy link
Member

Thanks for the PR, @claar!

I'm not a Laravel user so I'm quite unsure how we could implement the second solution you suggested... I'm going to merge this now and if you get any ideas, create an issue or send anoter PR (preferred!). 😀

igorsantos07 added a commit that referenced this pull request Nov 22, 2013
Allow subclass overriding of Validator
@igorsantos07 igorsantos07 merged commit e98ed2d into laravel-ardent:master Nov 22, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants