Store the user creating a record.

@param \Illuminate\Database\Eloquent\Model $model
966558
public function creating($model)
    {
        if ($model->accountableEnabled()) {
            $model->{$this->config['column_names']['created_by']} = $this->accountableUserId();
            $model->{$this->config['column_names']['updated_by']} = $this->accountableUserId();
        }
    }
556735
public function setModel(Model $model)
    {
        parent::setModel($model);

        if ($model->exists) {
            $this->setInstance($model);
            $this->loadRelationValues();
        }
    }
824966
public function save(Model $model)
    {
        $saved = $model->save();

        if ($saved) {
            app('cache')->flush();
        }

        return $saved;
    }
272752
public function saveToModel(Model $model, Request $request)
    {
        $this->setModel($model);

        $model->setAttribute($this->getFieldName(), $this->getSaveValue($request));

        return $this;
    }
857291
public function create(Model $model)
    {
        $metadata = $model->getMetadata();
        $insert = $this->createInsertObj($model);
        $this->getQuery()->executeInsert($metadata, $insert);
        return $model;
    }
929015
protected function saveColumns(Model $model)
    {
        /** @var \T4\Orm\Model $class */
        $class = get_class($model);
        $columns = $class::getColumns();
        $relations = $class::getRelations();
        $cols = [];
        $sets = [];
        $data = [];

        foreach ($columns as $column => $def) {
            if (isset($model->{$column}) && null === $model->{$column} && isset($def['default'])) {
                $sets[$column] = ':' . $column;
                $data[':'.$column] = $def['default'];
            } else {
                $cols[] = $column;
                $sets[$column] = ':' . $column;
                switch ($def['type']) {
                    case 'boolean':
                        $data[':' . $column] = (int)$model->{$column};
                        break;
                    default:
                        $data[':' . $column] = $model->{$column};
                        break;
                }
            }
        }

        foreach ($relations as $rel => $def) {
            switch ($def['type']) {
                case $class::BELONGS_TO:
                    $column = $class::getRelationLinkName($def);
                    if (!in_array($column, $cols)) {
                        // todo: test this!
                        //if (isset($model->{$column}) && !is_null($model->{$column})) {
                        if (isset($model->{$column})) {
                            $sets[$column] = ':' . $column;
                            $data[':'.$column] = $model->{$column};
                        } elseif (isset($model->{$rel}) && $model->{$rel} instanceof Model) {
                            $sets[$column] = ':' . $column;
                            $data[':'.$column] = $model->{$rel}->getPk();
                        }
                    }
                    break;
            }
        }

        $connection = $class::getDbConnection();
        if ($model->isNew()) {
            $query = new Query();
            $query->insert($class::getTableName())
                ->values($sets)
                ->params($data);
            $connection->execute($query);
            $model->{$class::PK} = $connection->lastInsertId();
        } else {
            $query = new Query();
            $query->update($class::getTableName())
                ->values($sets)
                ->where($this->quoteName($class::PK) . '='. $model->getPk())
                ->params($data);
            $connection->execute($query);
        }

        return $model;

    }
617497
protected function save($model)
    {
        $method = $this->saveMethod;

        if (!method_exists($model, $method)) {
            throw new SaveMethodNotFoundException(get_class($model), $method);
        }

        return $model->$method();
    }
475045
public function setModel(Model $model)
    {
        $this->model = $model;

        $this->query->from($model->getTable());

        return $this;
    }
1345434
public function save(Model $model)
    {
        if ($this->fieldId) {
            $model->setAttribute($this->fieldKey, $this->fieldId);
        }

        return parent::save($model);
    }
1089174
public function markSaved($model)
    {
        $hash = spl_object_hash($model);

        if (isset($this->pending[$hash])) {
            unset($this->pending[$hash]);
        }

        $this->saved[$hash] = $model;
    }
1032405
protected function saveFieldsets($model)
    {
        $fieldsets = input('fieldset', []);
        if (empty($fieldsets)) {
            return false;
        }
        foreach ($fieldsets as $name) {
            $fieldset = Fieldsets::query()->firstOrCreate(['name' => $name]);
            FieldFieldsets::query()->firstOrCreate([
                'fieldset_id' => $fieldset->id,
                'field_id'    => $model->id
            ]);
        }
    }
1083491
public function saved(Model $model)
    {
        if ($model::$__es_enable && $model->shouldIndex())
        {
            Queue::push('Iverberk\Larasearch\Jobs\ReindexJob', $this->findAffectedModels($model));
        }
    }
192761
public function create(Model $model)
    {
        $data['model'] = $this->createModelData($model);

        $modelResult = $this->getRequest()->request(
            'POST',
            $this->getRequestUrl('models'),
            $data
        );

        return $this->getModelFromResult($modelResult);
    }
1141763
public function save(Record $model)
    {
        $pk = $this->getPrimaryKey();

        if (isset($model->{$pk})) {
            $model->update();

            return $model->{$pk};
        } else {
            /** @var Record $previous */
            $previous = $model->exists();

            if ($previous) {
                $data = $model->toArray();

                if ($data) {
                    $previous->writeData($model->toArray());
                }
                $previous->update();

                $model->writeData($previous->toArray());

                return $model->getPrimaryKey();
            }
        }

        $model->insert();

        return $model->getPrimaryKey();
    }
1278418
public function saving(Page $model)
    {
        if ($model->is_home) {
            $query = Page::where('is_home', 1);
            if ($model->id) {
                $query->where('id', '!=', $model->id);
            }
            $query->update(['is_home' => 0]);
        }
    }
922982
public function setModel($model)
    {
        $this->model = get_class($model);
        $this->modelId = $model->id;
        
        return $this;
    }
850627
public function save(Domain $model): void
    {
        if (!$model->save()) {
            throw new \RuntimeException($this->i18n->t('setrun/sys', 'Saving error'));
        }
    }