Update the meta value for given parent id, name, type.

@param integer $modelId Parent Id.
@param string $name
@param string $type
@param type $value
@return int|false either 1 or false if meta not found or validation fails.
357983
public static function updateByNameType( $modelId, $name, $type, $value ) {

		$meta = self::findByNameType( $modelId, $name, $type );

		if( isset( $meta ) ) {

			$meta->value = $value;

			return $meta->update();
		}

		return false;
	}
1205232
public static function add($action, $type, $id = null)
    {
        if (!is_null($id))
            self::$modelMap[$type][$id] = $action;
        else
            self::$typeMap[$type] = $action;
    }
275662
protected function _setParameter($type, $name, $value)
    {
        $parray = array();
        $type = strtolower($type);
        switch ($type) {
            case 'get':
                $parray = &$this->paramsGet;
                break;
            case 'post':
                $parray = &$this->paramsPost;
                if ( $value === null ) {
                    if (isset($this->body_field_order[$name]))
                        unset($this->body_field_order[$name]);
                } else {
                    $this->body_field_order[$name] = self::VTYPE_SCALAR;
                }
                break;
        }

        if ($value === null) {
            if (isset($parray[$name])) unset($parray[$name]);
        } else {
            $parray[$name] = $value;
        }
    }
1304405
public function morphTo($name = null, $type = null, $id = null)
    {
        // If no name is provided, we will use the backtrace to get the function name
        // since that is most likely the name of the polymorphic interface. We can
        // use that to get both the class and foreign key that will be utilized.
        $name = $name ?: $this->guessBelongsToRelation();

        list($type, $id) = $this->getMorphs(
            Str::snake($name),
            $type,
            $id
        );

        // If the type value is null it is probably safe to assume we're eager loading
        // the relationship. In this case we'll just pass in a dummy query where we
        // need to remove any eager loads that may already be defined on a model.
        return empty($class = $this->{$type})
            ? $this->morphEagerTo($name, $type, $id)
            : $this->morphInstanceTo($class, $name, $type, $id);
    }
612004
@Transactional
  @PostMapping(value = "/{entityTypeId}/{id}", params = "_method=PUT")
  @ResponseStatus(OK)
  public void updatePost(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("id") String untypedId,
      @RequestBody Map<String, Object> entityMap) {
    updateInternal(entityTypeId, untypedId, entityMap);
  }
1255368
public static function queryByTypeParentTypeModelId( $type, $parentType, $modelId ) {

		return self::find()->where( 'type=:type AND parentType=:ptype AND modelId=:mid', [ ':type' => $type, ':parentType' => $parentType, ':mid' => $modelId ] );
	}
252111
public function setModelId($modelId)
    {
        $this->modelId = (string)$modelId;
        $this->model   = null;
        return $this;
    }
727256
public function morphTo($name = null, $type = null, $id = null)
    {

        // When the name and the type are specified we'll return a MorphedByOne
        // relationship with the given arguments since we know the kind of Model
        // and relationship type we're looking for.
        if ($name && $type)
        {
            // Determine the relation function name out of the back trace
            list(, $caller) = debug_backtrace(false);
            $relation = $caller['function'];
            return $this->morphedByOne($name, $type, $id, $relation);
        }

        // If no name is provided, we will use the backtrace to get the function name
        // since that is most likely the name of the polymorphic interface. We can
        // use that to get both the class and foreign key that will be utilized.
        if (is_null($name))
        {
            list(, $caller) = debug_backtrace(false);

            $name = snake_case($caller['function']);
        }

        list($type, $id) = $this->getMorphs($name, $type, $id);

        // If the type value is null it is probably safe to assume we're eager loading
        // the relationship. When that is the case we will pass in a dummy query as
        // there are multiple types in the morph and we can't use single queries.
        if (is_null($class = $this->$type))
        {
            return new MorphTo(
                $this->newQuery(), $this, $id, null, $type, $name
            );
        }

        // If we are not eager loading the relationship we will essentially treat this
        // as a belongs-to style relationship since morph-to extends that class and
        // we will pass in the appropriate values so that it behaves as expected.
        else
        {
            $instance = new $class;

            return new MorphTo(
                with($instance)->newQuery(), $this, $id, $instance->getKeyName(), $type, $name
            );
        }
    }
1223198
public function updateTranslations($params, $type)
    {
        if (is_null($translations = array_get($params, 'name'))) {
            return false;
        }
        try {
            DB::transaction(function() use($translations, $type) {
                foreach ($translations as $id => $value) {
                    $where        = [
                        'id'   => $id,
                        'area' => $type
                    ];
                    $model        = $this->makeModel()->newQuery()->where($where)->first();
                    $model->value = $value;
                    $model->save();
                }
            });
            return true;
        } catch (Exception $ex) {
            Log::emergency($ex);
            return false;
        }
    }
57397
public function add($id, $value, $parent = 'root', array $meta = [ ], array $attributes = [ ])
    {
        $node = new Node($id, $this, $value, $meta, $attributes);

        if (! is_null($parent) and $this->items->has($parent)) {
            $parentNode = $this->items->get($parent);
            $parentNode->addChild($node);
            $node->setMeta('data-parent', $parent);
        }

        $this->items->put($id, $node);

        return $node;
    }
338958
public function getByParent( $parentId, $parentType, $config = [] ) {

		$modelClass	= static::$modelClass;

		return $modelClass::findByParent( $parentId, $parentType, $config );
	}
763521
public function setModelType($modelType)
    {
        if ($modelType < self::MODELTYPE_ENTITY || $modelType > self::MODELTYPE_VALUEOBJECT) {
            throw new \InvalidArgumentException('"' . $modelType . '" is an invalid model type.', 1212519195);
        }
        $this->modelType = $modelType;
    }
538744
public function push($type, $name, $value)
    {
        $typeModel = NotificationTypes::where('name', $type)->first();
        if (is_null($typeModel)) {
            return false;
        }
        $tId   = $typeModel->id;
        $model = $this->makeModel()->getModel()->newInstance([
            'type_id' => $tId,
            'name'    => $name,
            'value'   => $value
        ]);
        $model->save();
        return $model;
    }
980844
public function setMeta($id, $name, $value, $field = 'value') {
        if (is_array($value)) {
            $value = json_encode($value, JSON_UNESCAPED_UNICODE);
        }

        return $this->updateMeta($id, $name, $field, $value);
    }
987545
public function updateDataMeta( $model, $key, $value ) {

		$model->updateDataMeta( $key, $value );

		$model->refresh();

		return $model;
	}
1131694
public static function findByParentModelIdType( $parentId, $parentType, $modelId, $type ) {

		return self::queryByParentModelId( $parentId, $parentType, $modelId )->andWhere( 'type=:type', [ ':type' => $type ] )->all();
	}
1218867
protected function _setParameter($type, $name, $value)
    {
        $parray = array();
        $type = strtolower($type);
        switch ($type) {
            case 'get':
                $parray = &$this->paramsGet;
                break;
            case 'post':
                $parray = &$this->paramsPost;
                break;
        }

        if ($value === null) {
            if (isset($parray[$name])) unset($parray[$name]);
        } else {
            $parray[$name] = $value;
        }
    }