Thank you, I already read the documentation, but I do not understand how to procede.
I would like to use my rules in several places of my application, so I suppose that I have to use a Validator class.
Where should I create it? Should I create it inside the "Services" folder?
Then I'm said to register that class with the code
Validator::resolver(function($translator, $data, $rules, $messages)
{
return new CustomValidator($translator, $data, $rules, $messages);
});
Where should I put that code? In which class? In which function?
You can create a file called validatorResolver.php to put your resolver and include it somewhere. As for CustomValidator, you can always create a Validators folder inside the app and have you class there. It will be autoloaded directly.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community