public function getFirstError($attribute = null)
    {
        if (empty($this->errors)) {
            return null;
        }
        if (isset($attribute)) {
            if (isset($this->errors[$attribute])) {
                return current($this->errors[$attribute]);
            }
            return null;
        }
        $error = current($this->errors);
        if (is_array($error)) {
            return current($error);
        }
        return $error;
    }
public function getFirstError($attribute = null)
    {
        if (empty($this->errors)) {
            return null;
        }
        if (isset($attribute)) {
            if (isset($this->errors[$attribute])) {
                return current($this->errors[$attribute]);
            }
            return null;
        }
        $error = current($this->errors);
        if (is_array($error)) {
            return current($error);
        }
        return $error;
    }
public function getFirstError ( $ attribute = null ) { if ( empty ( $ this -> errors ) ) { return null ; } if ( isset ( $ attribute ) ) { if ( isset ( $ this -> errors [ $ attribute ] ) ) { return current ( $ this -> errors [ $ attribute ] ) ; } return null ; } $ error = current ( $ this -> errors ) ; if ( is_array ( $ error ) ) { return current ( $ error ) ; } return $ error ; }
Returns first error.
@param string|null $attribute
@return string|null
Returns first error .