ActiveRecord\Errors::on PHP Method

on() public method

Returns the error message(s) for the specified attribute or null if none.
public on ( string $attribute ) : string/array
$attribute string Name of an attribute on the model
return string/array
    public function on($attribute)
    {
        $errors = $this->{$attribute};
        return $errors && count($errors) == 1 ? $errors[0] : $errors;
    }