src/Forms/Fields/Types/BaseType.php
public function error(string $name = '', bool $first = false)
    {
        $errors = $this->errors();

        if (empty($name)) {
            $name = $this->getName();
        }

        if ($first) {
            return $errors->first($name);
        }

        return $errors->get($name);
    }
public function error(string $name = '', bool $first = false)
    {
        $errors = $this->errors();

        if (empty($name)) {
            $name = $this->getName();
        }

        if ($first) {
            return $errors->first($name);
        }

        return $errors->get($name);
    }
public function error ( string $ name = '' , bool $ first = false ) { $ errors = $ this -> errors ( ) ; if ( empty ( $ name ) ) { $ name = $ this -> getName ( ) ; } if ( $ first ) { return $ errors -> first ( $ name ) ; } return $ errors -> get ( $ name ) ; }
Retrieve the field error messages.

@param string $name
@param bool   $first

@return string|array
Retrieve the field error messages .