Closed golinmarq closed 8 years ago
You should use
$this->validator->with($request->all())->passesOrFail('ADD_STATES');
instead of calling static variable
@tucq88 thanks, but should I do this even when I declare a constant called ADD_STATES?
I think it's not necessary to use a constant for that, if you dig deeper to the source, you can see that 2 original const are just simple string. And I see that their purpose is for only getting rules list, so I think using raw string is fine.
Right now, I'm using this package with l5-repositories. I need to create a custom method in my repository and request validation to it.
My CountryValidator seems like
And my controller looks like:
But when I send a invalid request (i.e. {}) the validator doesn't works and throws a passOrFail exception. What can it be?