public function rules() {
return [
['dob', 'validateBithday', 'skipOnEmpty' => false, 'skipOnError' => false],
];
}
public function validateBithday($attribute, $params)
{
if(date('Y', strtotime($attribute)) > data('Y')-18){
return $this->addError($attribute, 'You should be more years.');
}
}