I've created a class that extends LaravelValidatior and a method that needs to check some rules. For example
class ExtendLaravelValidator extends LaravelValidator {
public function validateRequiredIfSomething($attribute, $value, $parameters)
{
if(something())
{
return true;
}
return false;
}
}
Also I have some rules:
class CreateCompanyValidator extends Validator {
protected static $rules = [
'name' => 'required_if_something',
'address' => 'required_if_something',
}
As you probably figured it out, I need to call that required_if_something method always. It needs to act like laravel's required method. With each post I need to go thru all this fields. How can I accomplish that?