Touch all of the related models for the relationship.

E.g.: Touch all roles associated with this user.

@return void
14489
public function touch()
    {
        $key = $this->getRelated()->getKeyName();

        $columns = [
            $this->related->getUpdatedAtColumn() => $this->related->freshTimestampString(),
        ];

        // If we actually have IDs for the relation, we will run the query to update all
        // the related model's timestamps, to make sure these all reflect the changes
        // to the parent models. This will help us keep any caching synced up here.
        if (count($ids = $this->allRelatedIds()) > 0) {
            $this->getRelated()->newQuery()->whereIn($key, $ids)->update($columns);
        }
    }
380184
public function addConstraints()
    {
        if (static::$constraints) {
            $table = $this->related->getTable();

            $this->query->where($table.'.'.$this->otherKey, '=', $this->parent->{$this->foreignKey});
        }
    }
598204
public function touch() {
        $data = $this->cache->get($this->name);
        return $this->setData($data);
    }
628651
protected function changeRelationModel()
    {
        $module = getModule(get_called_class());
        $module = explode('-',$module);
        $module = ucfirst_tr($module[1]);
        $this->relations['thumbnails']['relation_model'] = "\\App\\{$module}Thumbnail";
        $this->relations['extras']['relation_model'] = "\\App\\{$module}Extra";
    }
1371446
public function filterRelations()
    {
        // Verify we can filter by relations and there are relations to filter by
        if ($this->relationsEnabled()) {
            foreach ($this->getAllRelations() as $related => $filterable) {
                // Make sure we have filterable input
                if (count($filterable) > 0) {
                    if ($this->relationIsJoined($related)) {
                        $this->filterJoinedRelation($related);
                    } else {
                        $this->filterUnjoinedRelation($related);
                    }
                }
            }
        }

        return $this;
    }
173144
private static function relations()
    {
        $files = ['OneToOne', 'OneToMany', 'ManyToMany', 'BelongsTo'];
        $folder = static::$root.'MVC/Relations'.'/';

        self::call($files, $folder);

        $files = ['ManyRelationException', 'ModelNotFindedException'];
        $folder = static::$root.'MVC/Relations/Exceptions'.'/';

        self::call($files, $folder);
    }
1336623
protected function parseRelationships()
    {
        foreach ($this->entityMap->getSingleRelationships() as $relation) {
            $this->parseSingleRelationship($relation);
        }

        foreach ($this->entityMap->getManyRelationships() as $relation) {
            $this->parseManyRelationship($relation);
        }
    }
115745
private function resolveRelations()
    {
        foreach ($this->entityDefinitions as $definition) {
            $this->resolveBelongsTo($definition);
            $this->resolveHasOneOrMany($definition);
            $this->resolveHasManyThrough($definition);
        }
    }
215148
public function setRolesAttribute($roles): void
    {
        static::saved(function (self $model) use ($roles) {
            $roles = collect($roles)->filter();

            $model->roles->pluck('id')->similar($roles)
            || activity()
                ->performedOn($model)
                ->withProperties(['attributes' => ['roles' => $roles], 'old' => ['roles' => $model->roles->pluck('id')->toArray()]])
                ->log('updated');

            $model->roles()->sync($roles, true);
        });
    }
425843
public function updateRelated()
    {
        foreach ($this->related as $name => $value) {
            if ($value instanceof Manager) {
                continue;
            }

            /** @var \Mindy\Orm\Fields\RelatedField $field */
            $field = $this->getField($name);
            if ($field instanceof HasManyField) {
                continue;
            }
            if (empty($value)) {
                $field->getManager()->clean();
            } else {
                $field->setValue($value);
            }
        }
        $this->related = [];
    }
438643
public function touch()
    {
        if ($this->started !== true) {
            throw new Exception\SessionNotStartedException('Tried to touch a session, but the session has not been started yet.', 1354284318);
        }

        // Only makes sense for remote sessions because the currently active session
        // will be updated on shutdown anyway:
        if ($this->remote === true) {
            $this->lastActivityTimestamp = $this->now;
            $this->writeSessionMetaDataCacheEntry();
        }
    }
417305
public function touchOwners()
    {
        foreach ($this->touches as $relation) {
            $this->$relation()->touch();

            if ($this->$relation instanceof self) {
                $this->$relation->fireModelEvent('saved', false);

                $this->$relation->touchOwners();
            } elseif (is_array($this->$relation)) {
                foreach ($this->$relation as $relation) {
                    $relation->touchOwners();
                }
            }
        }
    }
901689
public function reload()
	{
		$this->_relationships = array();
		$pk = array_values($this->getValuesFor($this->getPrimaryKey()));

		$this->setAttributesViaMassAssignment($this->find($pk)->attributes, false);
		$this->resetDirty();

		return $this;
	}
76041
public function actionRoleAssign() : void
    {
        $username = $this->prompt('Username:', ['required' => true]);
        $user = $this->findModel($username);
        $roleName = $this->select('Role:', ArrayHelper::map($this->authManager->getRoles(), 'name', 'description'));
        $role = $this->authManager->getRole($roleName);
        $this->authManager->assign($role, $user->id);
        $this->log(true);
    }
146665
public function touchLastSeen()
    {
        if ($this->isOnline()) {
            return;
        }

        $oldTimestamps = $this->timestamps;
        $this->timestamps = false;

        $this
            ->newQuery()
            ->where('id', $this->id)
            ->update(['last_seen' => $this->freshTimestamp()])
        ;

        $this->last_seen = $this->freshTimestamp();
        $this->timestamps = $oldTimestamps;
    }
783555
private function _removeDisabledRelations()
    {
        if (!$this->attrActive) {
            return false;
        }

        foreach ($this->_relationsToSave as $key => $rel) {

            if (!isset($rel->{$this->attrActive})) {
                continue;
            }

            if (!$rel->validate() && !$rel->{$this->attrActive}) {
                ArrayHelper::remove($this->_relationsToSave, $key);
            }
        }

        return true;
    }
660865
public function push()
	{
		if ( ! $this->save()) return false;

		// To sync all of the relationships to the database, we will simply spin through
		// the relationships and save each model via this "push" method, which allows
		// us to recurse into all of these nested relations for the model instance.
		foreach ($this->relations as $models)
		{
			$models = $models instanceof Collection
						? $models->all() : array($models);

			foreach (array_filter($models) as $model)
			{
				if ( ! $model->push()) return false;
			}
		}

		return true;
	}