src/Model.php
public function get_attribute( $attribute ) {

		if ( $this->has_relation( $attribute ) ) {
			return $this->get_relation_value( $attribute );
		}

		if ( array_key_exists( $attribute, static::table()->get_columns() ) ) {
			return $this->get_attribute_value( $attribute );
		}

		throw new \OutOfBoundsException(
			sprintf( "Requested attribute '%s' does not exist for '%s'.", $attribute, get_class( $this ) )
		);
	}
public function get_attribute( $attribute ) {

		if ( $this->has_relation( $attribute ) ) {
			return $this->get_relation_value( $attribute );
		}

		if ( array_key_exists( $attribute, static::table()->get_columns() ) ) {
			return $this->get_attribute_value( $attribute );
		}

		throw new \OutOfBoundsException(
			sprintf( "Requested attribute '%s' does not exist for '%s'.", $attribute, get_class( $this ) )
		);
	}
Get an attribute's or relation's value.

If it is an attribute, any accessors will be called.

If it is a relation, its results will be loaded and returned. The relation's results are cached.

@since 2.0

@param string $attribute Attribute name.

@return mixed

@throws \OutOfBoundsException If the given attribute does not exist.