Updates Parts on Skill

@param mixed $id
@param mixed $data
@return PayloadInterface
547842
public function updateParts($id, $data) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Skill not found.']);
		}

		// pass update to internal logic
		try {
			$this->doUpdateParts($model, $data);
		} catch (ErrorsException $e) {
			return new NotValid(['errors' => $e->getErrors()]);
		}

		// save and dispatch events
		$this->dispatch(SkillEvent::PRE_PARTS_UPDATE, $model, $data);
		$this->dispatch(SkillEvent::PRE_SAVE, $model, $data);
		$rows = $model->save();
		$this->dispatch(SkillEvent::POST_PARTS_UPDATE, $model, $data);
		$this->dispatch(SkillEvent::POST_SAVE, $model, $data);

		if ($rows > 0) {
			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
1360719
public function update($id, $data)
    {
        $siteId = $this->getRequestSiteId();

        //ACCESS CHECK
        $sitePagesResource = $this->getSitePagesResourceId($siteId);
        if (!$this->isAllowed('pages', 'edit')
            && !$this->isAllowed(
                $sitePagesResource,
                'edit'
            )
        ) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_401);

            return $this->getResponse();
        }

        $inputFilter = new SitePageUpdateInputFilter();

        $inputFilter->setData($data);

        if (!$inputFilter->isValid()) {
            return new ApiJsonModel(
                [],
                1,
                'Some values are missing or invalid for page update.',
                $inputFilter->getMessages()
            );
        }

        $data = $inputFilter->getValues();

        // <tracking>
        $data['modifiedByUserId'] = $this->getCurrentUserId();
        $data['modifiedReason'] = 'Update site in ' . get_class($this);

        $site = $this->getSite($siteId);

        if (empty($site)) {
            return new ApiJsonModel(
                null,
                1,
                "Site was not found with id {$siteId}."
            );
        }

        $page = $this->getPage($site, $id);

        $this->pageMutationService->updatePublishedVersionOfPage($this->getCurrentUser(), $page, $data);

        $apiResponse = new SitePageApiResponse($page);

        return new ApiJsonModel($apiResponse, 0, 'Success: Page updated.');
    }
464531
public function update($id, array $data)
    {
        $data = $this->resolverFactory->createAppResolver()->resolve($data);

        return $this->api->request('PUT', '/apps/'.$id, [
            'Authorization' => 'Basic '.$this->api->getConfig()->getUserAuthKey(),
        ], json_encode($data));
    }
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);
    }
499190
public function updateParents($id, $data) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Skill not found.']);
		}

		// pass update to internal logic
		try {
			$this->doUpdateParent($model, $data);
		} catch (ErrorsException $e) {
			return new NotValid(['errors' => $e->getErrors()]);
		}

		// save and dispatch events
		$this->dispatch(SkillEvent::PRE_CHILDREN_UPDATE, $model, $data);
		$this->dispatch(SkillEvent::PRE_SAVE, $model, $data);
		$rows = $model->save();
		$this->dispatch(SkillEvent::POST_CHILDREN_UPDATE, $model, $data);
		$this->dispatch(SkillEvent::POST_SAVE, $model, $data);

		if ($rows > 0) {
			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
843623
public function updateObjects($id, $data) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Sport not found.']);
		}

		// pass update to internal logic
		try {
			$this->doUpdateObjects($model, $data);
		} catch (ErrorsException $e) {
			return new NotValid(['errors' => $e->getErrors()]);
		}

		// save and dispatch events
		$this->dispatch(SportEvent::PRE_OBJECTS_UPDATE, $model, $data);
		$this->dispatch(SportEvent::PRE_SAVE, $model, $data);
		$rows = $model->save();
		$this->dispatch(SportEvent::POST_OBJECTS_UPDATE, $model, $data);
		$this->dispatch(SportEvent::POST_SAVE, $model, $data);

		if ($rows > 0) {
			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
350566
public function updateVariations($id, $data) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Skill not found.']);
		}

		// pass update to internal logic
		try {
			$this->doUpdateVariations($model, $data);
		} catch (ErrorsException $e) {
			return new NotValid(['errors' => $e->getErrors()]);
		}

		// save and dispatch events
		$this->dispatch(SkillEvent::PRE_VARIATIONS_UPDATE, $model, $data);
		$this->dispatch(SkillEvent::PRE_SAVE, $model, $data);
		$rows = $model->save();
		$this->dispatch(SkillEvent::POST_VARIATIONS_UPDATE, $model, $data);
		$this->dispatch(SkillEvent::POST_SAVE, $model, $data);

		if ($rows > 0) {
			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
7620
public function addLineages($id, $data) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Skill not found.']);
		}

		// pass add to internal logic
		try {
			$this->doAddLineages($model, $data);
		} catch (ErrorsException $e) {
			return new NotValid(['errors' => $e->getErrors()]);
		}

		// save and dispatch events
		$this->dispatch(SkillEvent::PRE_LINEAGES_ADD, $model, $data);
		$this->dispatch(SkillEvent::PRE_SAVE, $model, $data);
		$rows = $model->save();
		$this->dispatch(SkillEvent::POST_LINEAGES_ADD, $model, $data);
		$this->dispatch(SkillEvent::POST_SAVE, $model, $data);

		if ($rows > 0) {
			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
128053
public function addChildren($id, $data) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Skill not found.']);
		}

		// pass add to internal logic
		try {
			$this->doAddChildren($model, $data);
		} catch (ErrorsException $e) {
			return new NotValid(['errors' => $e->getErrors()]);
		}

		// save and dispatch events
		$this->dispatch(SkillEvent::PRE_CHILDREN_ADD, $model, $data);
		$this->dispatch(SkillEvent::PRE_SAVE, $model, $data);
		$rows = $model->save();
		$this->dispatch(SkillEvent::POST_CHILDREN_ADD, $model, $data);
		$this->dispatch(SkillEvent::POST_SAVE, $model, $data);

		if ($rows > 0) {
			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
765941
public function update($id, $data)
    {
        $data = $this->retrieveData($data);
        $updateData = [
            'methods'=> implode(',', $data['methods']),
        ];

        $this->table->update($updateData, ['id' => $id]);

        return $data;
    }
744830
public function updateFeaturedSkills($id, $data) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Video not found.']);
		}

		// pass update to internal logic
		try {
			$this->doUpdateFeaturedSkills($model, $data);
		} catch (ErrorsException $e) {
			return new NotValid(['errors' => $e->getErrors()]);
		}

		// save and dispatch events
		$this->dispatch(VideoEvent::PRE_FEATURED_SKILLS_UPDATE, $model, $data);
		$this->dispatch(VideoEvent::PRE_SAVE, $model, $data);
		$rows = $model->save();
		$this->dispatch(VideoEvent::POST_FEATURED_SKILLS_UPDATE, $model, $data);
		$this->dispatch(VideoEvent::POST_SAVE, $model, $data);

		if ($rows > 0) {
			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
31944
public function update($id, array $data)
    {
        $data = $this->resolverFactory->createExistingDeviceResolver()->resolve($data);

        return $this->api->request('PUT', '/players/'.$id, [], json_encode($data));
    }
1137270
public function update($id, $data)
    {
        $modelName = $this->modelFullName;
        if($this->validate($data, $modelName::$rules))
        {
            $model = $modelName::find($id);
            if(!$model) throw new NotFoundException('There is no Resource with id = ' . $id . ' !');
            $model->update($data);
            return $model;
        }
    }
746836
public function update($id, $data)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_201);

		$returnData = '';
		$action = strtolower($this->params()->fromQuery('action'));
		$classifiedService = $this->getServiceLocator()->get('document.service.classified');
		
		switch($action) {
			case 'activation':
				try {
					$classifiedService->activate($id);		
					$returnData = array(
						'status' => 'success',
						'message' => 'Annuncio attivato con successo. Ti ricordiamo che potrebbero essere 
							necessarie alcune ore prima di poter visualizzare l\'annuncio.'
					);
				} catch(\Exception $e) {
					$this->getResponse()
						->setStatusCode(Response::STATUS_CODE_500);
					$returnData = array(
						'status' => 'danger',
						'message' => $e->getMessage()
					);
				}
				break;
			case 'disableenable':
				try {
					$classifiedService->enableDisable($id);		
					$returnData = array(
						'status' => 'success',
						'message' => 'Annuncio modificato con successo'
					);
				} catch(\Exception $e) {
					$this->getResponse()
						->setStatusCode(Response::STATUS_CODE_500);
					$returnData = array(
						'status' => 'danger',
						'message' => $e->getMessage()
					);
				}
				break;
			case 'touch':
				try {
					$classifiedService->touch($id);		
					$returnData = array(
						'status' => 'success',
						'message' => 'Annuncio aggiornato con successo'
					);
				} catch(\Exception $e) {
					$this->getResponse()
						->setStatusCode(Response::STATUS_CODE_500);
					$returnData = array(
						'status' => 'danger',
						'message' => $e->getMessage()
					);
				}
				break;
		}
		
		return new JsonModel($returnData);
	}
752811
public function update(array $data, $id)
    {
        $this->sqlBuilder->addWhere($this->primaryKey, $id);
        return $this->updates($data);
    }
642665
public function addObjects($id, $data) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Sport not found.']);
		}

		// pass add to internal logic
		try {
			$this->doAddObjects($model, $data);
		} catch (ErrorsException $e) {
			return new NotValid(['errors' => $e->getErrors()]);
		}

		// save and dispatch events
		$this->dispatch(SportEvent::PRE_OBJECTS_ADD, $model, $data);
		$this->dispatch(SportEvent::PRE_SAVE, $model, $data);
		$rows = $model->save();
		$this->dispatch(SportEvent::POST_OBJECTS_ADD, $model, $data);
		$this->dispatch(SportEvent::POST_SAVE, $model, $data);

		if ($rows > 0) {
			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
980446
protected function _update($id, array $data)
    {
        return $this->db->update($this->table, $data, ['id' => $id]);
    }