Determine if the widget has a related object.

@return boolean
961011
public function hasObj()
    {
        if ($this->obj === null) {
            try {
                $this->obj();
            } catch (InvalidArgumentException $e) {
                return false;
            }
        }

        return !empty($this->obj);
    }
13846
function hasChildren()
    {
        return array( $this->SetName => false,
                      $this->LetName => true,
                      $this->DefaultName => true );
    }
283843
public function hasSecondaryMenu()
    {
        $ident    = $this->ident();
        $metadata = $this->adminSecondaryMenu();

        if (isset($metadata[$ident])) {
            return $this->hasLinks() ||
                   $this->hasGroups() ||
                   $this->hasActions() ||
                   $this->showTitle() ||
                   $this->showDescription();
        }

        return false;
    }
64523
private function hasRelation($type)
    {
        return in_array(
            $type,
            [
                ClassMetadataInfo::MANY_TO_MANY,
                ClassMetadataInfo::ONE_TO_MANY,
                ClassMetadataInfo::ONE_TO_ONE,
            ],
            true
        );
    }
62287
public function has($key)
    {
        $result = $this->get($key);

        //an empty EntityCollection means no related entities
        if ($result instanceof EntityCollection && count($result) === 0) {
            return false;
        }

        return $result ? true : false;
    }
843638
public function hasIncludedRelationships(): bool
    {
        if ($this->includedRelationships === null) {
            $this->setIncludedRelationships();
        }

        return empty($this->includedRelationships) === false;
    }
1137848
private function isRelation($type)
    {
        return in_array(
            $type,
            [
                ClassMetadataInfo::MANY_TO_MANY,
                ClassMetadataInfo::ONE_TO_MANY,
                ClassMetadataInfo::ONE_TO_ONE,
            ],
            true
        );
    }
757067
private function hasMany()
    {
        // Return if there are no relationships of that type
        if (!isset($this->relationships['hasMany']) || empty($this->relationships['hasMany'])) {
            return $this;
        }

        // Get current records IDs
        $ids = array_column($this->records, 'id');

        // Return if no records where found
        if (empty($ids)) {
            return $this;
        }

        // Make a associative array from current records
        $records = array_combine($ids, $this->records);

        // Iterate relationships
        foreach ($this->relationships['hasMany'] as $join) {

            // Get relationship results trought the model
            if (isset($join['model'])) {
                if (isset($this->models) && isset($this->models[$join['model']])) {
                    $instance = $this->models[$join['model']];
                } else {
                    $instance = new $join['model'];
                }
                $childs = $instance->whereIn($join['foreignKey'], $ids)->limit($join['limit'])->orderBy($join['orderBy'])->get();
            }

            // Or get relationship results by database
            if (!isset($join['model'])) {
                $join['orderBy'] = isset($join['orderBy'])? $join['orderBy'] : 'id';
                $childs = $this->db()->table($join['table'])->select(array_merge([$join['foreignKey']], $join['columns']))->whereIn($join['foreignKey'], $ids)->limit($join['limit'])->orderBy($join['orderBy'])->get();
            }

            // Group them by foreign key
            if ($childs) {
                foreach ($childs as $child) {
                    $key = $join['foreignKey'];
                    $id = $child[$key];

                    // If the ID was not required as a column to show, leave it out
                    if (!in_array($key, $join['columns'])) {
                        unset($child[$key]);
                    }

                    // Save the result
                    $join['results'][$id][] = $child;
                }
            }

            // Add relationship results to the main collection
            foreach ($records as $key => $value) {
                $id = $value[$join['localKey']];
                $records[$id][$join['alias']] = (isset($join['results'][$id]))? $join['results'][$value[$join['localKey']]] : [];
            }
        }

        // Save the records with the resolved relationships
        $this->records = array_values($records);

        // Return model instance
        return $this;
    }
954969
public function hasOne($related, $foreignKey = null, $localKey = null)
    {
        if (is_array($foreignKey)) { //Check for multi-columns relationship
            $this->validateRelatedModel($related);
        }

        $instance = $this->newRelatedInstance($related);

        $foreignKey = $foreignKey ?: $this->getForeignKey();

        $foreignKeys = null;

        if (is_array($foreignKey)) { //Check for multi-columns relationship
            foreach ($foreignKey as $key) {
                $foreignKeys[] = $this->sanitizeKey($instance, $key);
            }
        } else {
            $foreignKey = $this->sanitizeKey($instance, $foreignKey);
        }

        $localKey = $localKey ?: $this->getKeyName();

        return new HasOne($instance->newQuery(), $this, $foreignKeys ?: $foreignKey, $localKey);
    }
111703
public function hasAllWidgets($widgets): bool
    {
        // Single widget id
        if (is_string($widgets)) {
            return $this->widgets->contains('id', $widgets);
        }

        // Single widget id
        if (is_int($widgets)) {
            return $this->widgets->contains('id', $widgets);
        }

        // Single widget model
        if ($widgets instanceof WidgetModelContract) {
            return $this->widgets->contains('id', $widgets->id);
        }

        // Array of widget ids
        if (is_array($widgets) && isset($widgets[0]) && is_string($widgets[0])) {
            return $this->widgets->pluck('id')->count() === count($widgets)
                && $this->widgets->pluck('id')->diff($widgets)->isEmpty();
        }

        // Array of widget ids
        if (is_array($widgets) && isset($widgets[0]) && is_int($widgets[0])) {
            return $this->widgets->pluck('id')->count() === count($widgets)
                && $this->widgets->pluck('id')->diff($widgets)->isEmpty();
        }

        // Collection of widget models
        if ($widgets instanceof Collection) {
            return $this->widgets->count() === $widgets->count() && $this->widgets->diff($widgets)->isEmpty();
        }

        return false;
    }
518302
public function is_related($query) {
        if (!$this->load_choices() or empty($this->choices)) {
            return false;
        }
        if (parent::is_related($query)) {
            return true;
        }

        foreach ($this->choices as $desc) {
            if (strpos(core_text::strtolower($desc), $query) !== false) {
                return true;
            }
        }
        return false;
    }
206118
public function hasPrevPost()
    {
        return ($this->prevPost && $this->prevPost->ID !== $this->get('ID')) ? true : false;
    }
1179838
public function isRelative() {
		if ($this->host === null) {
			return true;
		}
		
		if ($this->host === '/' || $this->host === '//') {
			return true;
		}
		
		return false;
	}
808989
private function isRelation($type)
    {
        return in_array(
            $type,
            [
                ClassMetadataInfo::REFERENCE_ONE,
                ClassMetadataInfo::REFERENCE_MANY,
                ClassMetadataInfo::EMBED_ONE,
                ClassMetadataInfo::EMBED_MANY,
            ],
            true
        );
    }
873506
public function hasPatterns()
    {
        if ($this->isReference() && $this->getProject() !== null) {
            return $this->getRef($this->getProject())->hasPatterns();
        }

        if ($this->defaultPatterns->hasPatterns()) {
            return true;
        }

        for ($i = 0, $size = count($this->additionalPatterns); $i < $size; $i++) {
            $ps = $this->additionalPatterns[$i];
            if ($ps->hasPatterns()) {
                return true;
            }
        }

        return false;
    }
819919
public function hasPresenter(): bool
    {
        static $hasPresenter;

        if (is_bool($hasPresenter)) {
            return $hasPresenter;
        }

        if ($this->icons_type != 'select2') {
            return false;
        }

        $className = $this->icons_presenter_class;
        $hasPresenter = class_exists($className) && app($className) instanceof IconSetInterface;

        return $hasPresenter;
    }
1328760
public boolean isCollection()
    {
        return type.equals(Relation.ForeignKey.ONE_TO_MANY) || type.equals(Relation.ForeignKey.MANY_TO_MANY);
    }