ActiveRecord\Errors::add_on_blank PHP Method

add_on_blank() public method

Adds the error message only if the attribute value was null or an empty string.
public add_on_blank ( string $attribute, string $msg )
$attribute string Name of an attribute on the model
$msg string The error message
    public function add_on_blank($attribute, $msg)
    {
        if (!$msg) {
            $msg = self::$DEFAULT_ERROR_MESSAGES['blank'];
        }
        if (($value = $this->model->{$attribute}) === '' || $value === null) {
            $this->add($attribute, $msg);
        }
    }