Stores a submitted value on a model, after it has been created (or saved).

@param Model|Taggable $model
@param mixed $source
@param mixed $value
489296
public function performStoreAfter(Model $model, $source, $value)
    {
        $value = $this->adjustValue($value);

        $model->retag($value);
    }
402442
public function update(Source $model, UpdateRequest $request)
    {
        $data = $request->all();

        $model->update($data);

        \Cache::tags('response')->flush();

        return $this->successJsonResponse();
    }
356379
public function setModel(\atk4\data\Model $model)
    {
        parent::setModel($model);
        $this->field = $this->field ? $this->field : $this->model->title_field;
        if ($this->autoSave && $this->model->loaded()) {
            if ($this->cb->triggered()) {
                $value = $_POST['value'] ? $_POST['value'] : null;
                $this->cb->set(function () use ($value) {
                    try {
                        $this->model[$this->field] = $this->app->ui_persistence->typecastLoadField($this->model->getElement($this->field), $value);
                        $this->model->save();

                        return $this->jsSuccess('Update successfully');
                    } catch (ValidationException $e) {
                        $this->app->terminate(json_encode([
                              'success'            => true,
                              'hasValidationError' => true,
                              'atkjs'              => $this->jsError(call_user_func($this->formatErrorMsg, $e, $value))->jsRender(),
                          ]));
                    }
                });
            }
        }

        return $this->model;
    }
893591
public function afterSave(Model $model, $created, $options = array()) {
        $id = $model->id;
        $settings = $this->settings[$model->alias];
        $events = $settings['events'];

        // Use slug if that's the primary
        if ($model->primaryKey === 'slug') {
            $method = $settings['methodKeys']['getBySlug'];
        } else {
            $method = $settings['methodKeys']['getById'];
        }

        // Refresh the cache during update/create
        if ($id && $method && (($created && $events['onCreate']) || (!$created && $events['onUpdate']))) {
            $cacheKey = array($model->alias . '::' . $method, $id);

            if (method_exists($model, $method)) {
                $this->deleteCache($model, $cacheKey);
                call_user_func(array($model, $method), $id);

            } else {
                $this->writeCache($model, $cacheKey, array($model->read(null, $id)));
            }
        }

        if ($getList = $settings['methodKeys']['getList']) {
            $this->deleteCache($model, array($model->alias . '::' . $getList));
        }

        if ($getCount = $settings['methodKeys']['getCount']) {
            $this->deleteCache($model, array($model->alias . '::' . $getCount));
        }

        return true;
    }
16161
final public function upsert(TagKey $key, TagValue $value)
    {
        $this->m[$key->getName()] = new Tag($key, $value);
    }
632519
public void addParameter(final String tag, final Object value) {
		if (Util.empty(tag)) {
			throw new IllegalArgumentException("A tag must be provided");
		}

		TemplateModel model = getOrCreateComponentModel();
		if (model.parameters == null) {
			model.parameters = new HashMap<>();
		}
		model.parameters.put(tag, value);
	}
653277
public function addEdge( $source, $target, $value = 1 )
	{
		return $this->edgeSet->addEdge( $source, $target, $value );
	}
850627
public function save(Domain $model): void
    {
        if (!$model->save()) {
            throw new \RuntimeException($this->i18n->t('setrun/sys', 'Saving error'));
        }
    }
892973
public function beforeValidationOnCreate(Event $event, Model $model)
    {
        if($model instanceof ITimestampable) {
            $now = $this->getNow();
            if(!$model->getCreatedAt()) {
                $model->setCreatedAt($now);
            }
            if(!$model->getUpdatedAt()) {
                $model->setUpdatedAt($now);
            }
        }
    }
830753
public function addEdge( $source, $target, $value = 1 )
	{
		$edge	= $this->edgeSet->addEdge( $source, $target, $value );
		if( $this->hasCycle() )
		{
			$this->edgeSet->removeEdge( $source, $target );
			return false;
		}
		return $edge;
	}
199840
private function copySource(TranslationValueInterface $source, WritableTranslationValueInterface $target): void
    {
        if (self::DO_NOT_COPY === $this->copySource) {
            return;
        }

        if (($oldValue = $target->getSource()) === ($newValue = $source->getSource())) {
            $this->logger->log(
                $this->logLevel,
                '{key}: Source is same, no need to update.',
                ['key' => $target->getKey(), 'old' => $oldValue, 'new' => $newValue]
            );
            return;
        }

        if ((self::COPY_IF_EMPTY === $this->copySource) && !$target->isSourceEmpty()) {
            $this->logger->log(
                $this->logLevel,
                '{key}: Source is not empty, no need to update.',
                ['key' => $target->getKey(), 'old' => $oldValue, 'new' => $newValue]
            );

            return;
        }

        $this->logger->log(
            LogLevel::NOTICE,
            '{key}: Updating source value.',
            ['key' => $target->getKey(), 'old' => $oldValue, 'new' => $newValue]
        );

        if ($this->dryRun) {
            return;
        }

        $target->setSource($newValue);
    }
1223527
public static function createTagFromModel(Model $model)
    {
        return new Tag((string) $model->id, $model->name, $model->row());
    }
835194
public function retrieve(Model $model, $source)
    {
        $data = [
            'longitude' => null,
            'latitude'  => null,
            'location'  => null,
        ];

        if ($latitude = $this->getAttributeLatitude()) {
            $data['latitude'] = (float) parent::retrieve($model, $latitude);
        }

        if ($longitude = $this->getAttributeLongitude()) {
            $data['longitude'] = (float) parent::retrieve($model, $longitude);
        }

        if ($text = $this->getAttributeText()) {
            $data['location'] = parent::retrieve($model, $text);
        }

        return $data;
    }
548132
public function addEdge( $source, $target, $value = 1 )
	{
		if( $source->getNodeName() < $target->getNodeName() )
			return $this->edgeSet->addEdge( $source, $target, $value );
		else
			return $this->edgeSet->addEdge( $target, $source, $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)
            );
        }
    }
1203944
public function render(Model $model, $source)
    {
        $count = $this->getCount(
            $this->getActualNestedRelation($model, $source)
        );

        if ( ! $count) {
            return '<span class="relation-count count-empty">&nbsp;</span>';
        }

        return '<span class="relation-count">' . $count . '</span>';
    }
856854
public function afterInsert($model, $id)
    {
        if ($this->weak) {
            return;
        }

        $this->save_buffer[$this->foreign_field] =
            isset($this->join) ? $this->join->id : $id;

        $persistence = $this->persistence ?:
            $this->owner->persistence;

        $this->id = $persistence->insert(
            $model,
            $this->save_buffer,
            $this->foreign_table
        );
    }