Closed grena closed 10 years ago
Hi! I've used plenty of database-based validation using this pattern. I'm not sure I have quite enough information to let you know why this might be not working for you.
However, I have a theory. If you check issue #14, you'll see that for any validator class, I use a Service Provider and provide the validator service class with Laravel's validator via the Application container: $app['validator']
. This gives the validator class a complete (all dependencies, such as PresenceVerifier, included) Validator object to use.
You can see the code on how $app['validator']
is created, and also how the Presence Verifier is added as well.
Let me know if I'm off-base in my guess here!
(It's also definitely possible that updates to Laravel 4.1 may have created some breaking changes to my code, in which case I'll fix it up in the code in book.)
In the abstract validator constructor I've: $this->validator = \App::make['validator']; This resolve Presence Verifier and Translator Interface issues for me.
Hi !
By adopting the Repo pattern, I'm facing an issue with validating a "unique" field with validator. Here is my rule :
And the error :
What I understood is that the PresenceVerifier is used to count elements in database (to ensure it's unique), but since we use RepoInterfaces, it's broken.
How can I deal with that ?