add custom error message to a model in Yii

{Code}

$model->addError('string:attribute', 'string error message)
public void addError(string $attribute, string $error)

 

{Boy Said}

You can also get all error messages in a model by this way.