Update an existing record, retrieved by id.

@param int $id
@param array $inputs

@return mixed
976758
public function updateById($id, array $inputs)
    {
        $inputs = $this->purifyInputs($inputs);

        $model = $this->model->findOrFail($id);

        return $model->update($inputs);
    }
955041
public function update($id, array $data)
    {
        return $this->put($this->getPath().'/'.rawurlencode($id), $data);
    }
817476
public function update($id, array $values, $idCol)
    {
        return (bool) $this->getSelection()
            ->where('?name = ?', $idCol, $id)
            ->update($values);
    }
675919
public function update($id, $data, array $options = []) {
        return $this->query(Query::UPDATE)
            ->where($this->getPrimaryKey(), $id)
            ->save($data, $options);
    }
551937
public function update($id = null, $attributes = [])
    {
        // Check the ID
        if (!isset($id)) {
            throw new \InvalidArgumentException('Undefined ID', 400);
        }

        // Set the attributes
        $attributes = (!empty($attributes))? $attributes : $this->app->request->input();

        // Update the record
        $result = $this->model->update($id, $attributes);

        // Return results
        return [
            'success' => true,
            'id' => $id,
            'data' => $result
        ];
    }
270362
public function update($stateId, InputStruct $input)
    {
        $objectState = $this->objectStateMapper->createObjectStateFromInputStruct($input);
        $objectState->id = (int)$stateId;

        $this->objectStateGateway->updateObjectState($objectState);

        return $this->load($objectState->id);
    }
304136
public function update($id)
    {
        $file = $this->fileRepo->getById($id);
        if (!empty($file)) {
            $this->authorize('update', $file);
            $input = $this->validator->validate('update');
            $file  = $this->fileRepo->update($file, $input, Auth::user());
            return $this->respondWithSuccess($file, new FileTransformer);
        }
        return $this->respondNotFound();
    }
63367
public function update($id, $data)
    {
        $response = $this->handler->handle('PUT', $data);

        return $this->make($response, false);
    }
1128921
public function update($id, $data = null)
    {
        $data = ($data) ?: request()->all();

        $isEditable = $this->isEditable($data);

        if (($response = $this->handleColumnUpdates($id, $data)) instanceof Response) {
            return $response;
        }

        /* @var Model $this->model */
        $builder = $this->model();

        if ($this->isSoftDeletes) {
            $builder = $builder->withTrashed();
        }

        $this->model = $builder->with($this->getRelations())->findOrFail($id);

        $this->setFieldOriginalValue();

        // Handle validation errors.
        if ($validationMessages = $this->validationMessages($data)) {
            if (!$isEditable) {
                return back()->withInput()->withErrors($validationMessages);
            }

            return response()->json(['errors' => Arr::dot($validationMessages->getMessages())], 422);
        }

        if (($response = $this->prepare($data)) instanceof Response) {
            return $response;
        }

        DB::transaction(function () {
            $updates = $this->prepareUpdate($this->updates);

            foreach ($updates as $column => $value) {
                /* @var Model $this->model */
                $this->model->setAttribute($column, $value);
            }

            $this->model->save();

            $this->updateRelation($this->relations);
        });

        if (($result = $this->callSaved()) instanceof Response) {
            return $result;
        }

        if ($response = $this->ajaxResponse(trans('admin.update_succeeded'))) {
            return $response;
        }

        return $this->redirectAfterUpdate($id);
    }
95818
public function update(array $inputs)
    {
        $inputs = $this->purifyInputs($inputs);

        return $this->model->update($inputs);
    }
1315292
public static function custom($id, $input)
    {
        return (new static($id))->setInput($input instanceof BasicFormElement ? $input : new $input($id));
    }
1223680
public function update(RuleUpdateListener $listener, $id, array $input)
    {
        if (empty(array_get($input, 'expired_at'))) {
            $input['expired_at'] = null;
        }

        $rule = $this->repository->findById($id);
        $rule->fill($input);

        if (!$rule) {
            return $listener->notFound($id);
        }

        $form             = $this->presenter->form($rule);
        $validationHelper = new ValidationHelper($form, $this->validation->on('update'), $input);

        if (!$validationHelper->isValid()) {
            return $listener->updateRuleFailedValidation($validationHelper->getMessageBag(), $id);
        }
        try {
            $this->repository->update($rule);
            return $listener->updateRuleSuccess($rule);
        } catch (Exception $e) {
            Log::critical($e->getMessage());
            return $listener->updateRuleFailed(['error' => $e->getMessage()]);
        }
    }
980446
protected function _update($id, array $data)
    {
        return $this->db->update($this->table, $data, ['id' => $id]);
    }
1125902
public function update($listener, array $input, $id)
    {
        if ((int) $id !== (int) $input['id']) {
            return $listener->userVerificationFailed();
        }

        $validation = $this->validator->on('update')->bind(['roleID' => $id])->with($input);

        if ($validation->fails()) {
            return $listener->updateValidationFailed($validation, $id);
        }

        $role = $this->model->findOrFail($id);

        try {
            $this->saving($role, $input, 'update');
        } catch (Exception $e) {
            return $listener->updateFailed(['error' => $e->getMessage()]);
        }

        return $listener->updateSucceed($role);
    }
118610
public function updateEventMessageById($id, $fields) {
        $event = new \CEventMessage;
        if ($event->Update($id, $fields)) {
            return $id;
        }

        $this->throwException(__METHOD__, $event->LAST_ERROR);
    }
109136
public function updateByStringId(array $data, string $id): Model
    {
        $model = $this->byStringIdOrFail($id);

        return $this->updateByModel($model, $data);
    }
889465
public function update($id)
    {
        // Get the model instance
        $item = $this->findOrFail($id);

        // Remove nested model data from input and prepare to insert on save
        $input = (new NestedModels)->relateTo($item);

        // Hydrate for drag-and-drop sorting
        if (Request::ajax()
            && ($position = new Position($item, $this->self_to_parent))
            && $position->has()) {
            $position->fill();
        }

        // ... else hydrate normally
        else {
            $item->fill($input);
            if (isset($item::$rules['slug'])) {
                $pattern = '#(unique:\w+)(,slug)?(,(NULL|\d+))?#';
                $item::$rules['slug'] = preg_replace($pattern, '$1,slug,'.$id, $item::$rules['slug']);
            }
        }

        // Save the record
        $this->validate($item);
        $item->save();

        // Redirect to the edit view
        if (Request::ajax()) {
            return Response::json();
        } else {
            return Redirect::to(URL::current())
            ->with('success', $this->successMessage($item));
        }
    }