Apply the filter to relationship query builder.

@param  string $key
@param  string $value
@return void
491069
protected function filterRelation($key, $value)
    {
        $key = str_replace('~', '.', $key);
        $parts = explode('.', $key);

        $realKey = array_pop($parts);
        $relation = implode('.', $parts);

        if (! in_array($relation, array_keys($this->with))) {
            return;
        }

        extract($this->formatParam($realKey, $value));

        if (! $this->canFilter($column)) {
            return;
        }

        $this->builder->whereHas($relation, function ($q) use ($column, $comparator, $value) {
            if ($comparator == 'IN') {
                $values = explode(',', $value);
                $q->whereIn($column, $values);
            } elseif ($comparator == 'NOT IN') {
                $values = explode(',', $value);
                $q->whereNotIn($column, $values);
            } else {
                $values = explode('|', $value);
                if (count($values) > 1) {
                    $q->where(function ($query) use ($column, $comparator, $values) {
                        foreach ($values as $value) {
                            if ($comparator == 'LIKE' || $comparator == 'NOT LIKE') {
                                $value = preg_replace('/(^\*|\*$)/', '%', $value);
                            }
                            // Link the filters with AND of there is a "not" and with OR if there's none
                            if ($comparator == '!=' || $comparator == 'NOT LIKE') {
                                $query->where($column, $comparator, $value);
                            } else {
                                $query->orWhere($column, $comparator, $value);
                            }
                        }
                    });
                } else {
                    $value = $values[0];
                    if ($comparator == 'LIKE' || $comparator == 'NOT LIKE') {
                        $value = preg_replace('/(^\*|\*$)/', '%', $value);
                    }
                    if ($comparator == 'NULL' || $comparator == 'NOT NULL') {
                        $q->whereNull($column, 'and', $comparator == 'NOT NULL');
                    } else {
                        $q->where($column, $comparator, $value);
                    }
                }
            }
        });
    }
338012
public function setCache($key, $value) {
        if($this->cacheEnabled) {
            $this->cacheObj->save($key, $value);
        }
    }
766191
public function setModelAttribute($value)
    {
        if (! empty($this->filteredFieldKey)) {
            parent::setModelAttribute($value);

            $this->setModelAttributeKey($this->filteredFieldKey);
            parent::setModelAttribute(
                $this->filterValue($value)
            );
        } else {
            parent::setModelAttribute(
                $this->filterValue($value)
            );
        }
    }
638400
public function setQueryVariable($key, $value)
    {
        Validate::isString($key, 'key');
        Validate::isString($value, 'value');

        $this->_url->setQueryVariable($key, $value);
    }
1000107
public function set(string $key, $value)
    {
        if (!is_array($value)) {
            $value = [$value];
        }
        $this->normSet($key, $value);
    }
546073
public function offsetSet($key, $value)
    {
        if ($key === 'query' && isset($value)) {
            $value = $this->_queryToArray($value);
        }
        $this->data[$key] = $value;
    }
432836
public function pairs($key, $value)
	{
		$this->select([$key, $value]);

		$query = $this->compiler->select();

		return $this->connection->pairs($query['sql'], $query['params']);
	}
1308564
public function search($key, $value)
	{
		foreach ($this->rows as $row)
		{
			if ($row->$key == $value)
			{
				return true;
			}
		}

		return false;
	}
1144550
public function setMeta(string $key, $value)
    {
        if ($this->hasMeta($key)) {
            $meta = $this->getMetaRecord($key);
            $meta->setAttribute('value', $value);
            $meta->save();
        } else {
            $meta = $this->makeMeta($key, $value);
            $this->meta()->save($meta);
        }

        // Update cached relationship, if necessary.
        if ($this->relationLoaded('meta')) {
            $this->meta[$key] = $meta;
        }
    }
525308
public function offsetSet($key, $value) {
        if(!$this->offsetExists($key)) {
            $this->table[$key] = new Value($value);
        } else {
            $this->table[$key]->setValue($value);
        }
    }
906786
public function set($key, $value) {
		$this->loadIfNeeded();

		$this->array[$key] = $value;

		$this->saver->save($this->fileName, $this->array, $this->fileMap);
	}
1018752
protected function conditionalSet($key, $value)
    {
        if (!$this->has($key)) {
            $this->set($key, $value);
        }
    }
757170
public function setAttribute($key, $value)
    {
        if (in_array($key, $this->autofillRelationships)) {
            $this->autofilledRelations[camel_case($key)] = $value;
            return $this;
        } else {
            return parent::setAttribute($key, $value);
        }
    }
89949
public function setCustomConfig($key, $value) {
        if ($this->searchParams->config->customConfig == null) {
            $this->searchParams->config->customConfig = array();
        }

        $this->searchParams->config->customConfig[$key] = $value;
    }
1204130
protected function addParam($key, $value = null)
	{
		if (is_null($value))
		{
			$this->params[] = $key;
		}
		else
		{
			$this->params[$key] = $value;
		}

	}
1095993
public function delete(string $value, string $key = null)
    {
        // Checks if a key was given
        if (isset($key)) {

            // Any key could be use in the where clause
            $query = 'DELETE FROM ' . $this->table . ' WHERE ' . $key . ' = ?';
        } else {
            // The id key would be use in the where clause
            $query = 'DELETE FROM ' . $this->table . ' WHERE id = ?';
        }
        // Executes the query
        $this->database->action($query, [$value]);
    }
1077515
private function alter($key, $value)
    {
        if ($this->has($key)) {
            $this->data[$key][self::CACHE_PARAM_VALUE] = $value;
        }
    }