addRule() public method
Adds a validation rule to this model. You can also directly manipulate $validators to add or remove validation rules. This method provides a shortcut.
public $this addRule ( $attributes, $validator, $options = [] )$attributes
string|array
The attribute(s) to be validated by the rule $validator mixed
The validator for the rule.This can be a built-in validator name, a method name of the model class, an anonymous function, or a validator class name. $options arr