/** * 更新 * * @param array $input * @param $id * @return bool * @throws GeneralException * @internal param $roles */ public function update(array $input, $id) { if (parent::update($input, $id)) { return true; } throw new GeneralException('There was a problem updating this user. Please try again.'); }
/** * @param array $attributes * @param $id * @return mixed */ public function update(array $attributes, $id) { $role = $this->find($id); if ($attributes['display_name'] === $role->display_name) { unset($attributes['display_name']); } return parent::update($attributes, $id); }
/** * Update attributes * * @param array $attributes * @param integer $id * * @return Model */ public function update(array $attributes, $id) { $defaults = ["{$this->getRelationName()}" => []]; $attributes = array_merge($defaults, $attributes); $model = parent::update($attributes, $id); $model->{$this->getShortRelationName()}()->sync($attributes["{$this->getRelationName()}"]); return $this->parserResult($model); }
public function update(array $attributes, $id) { try { return parent::update($attributes, $id); } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'Cliente não encontrado.']; } }
/** * @param array $attributes * @param $id * @return mixed */ public function update(array $attributes, $id) { $user = $this->find($id); if ($user->email === $attributes['email']) { unset($attributes['email']); } $user = parent::update($attributes, $id); $this->updateRoles($user, $attributes); event(new UserWasUpdated($user, $attributes)); return $this->parserResult($user); }
/** * Update attributes * * @param array $attributes * @param integer $id * * @return Model */ public function update(array $attributes, $id) { $defaults = ['roles' => []]; $attributes = array_merge($defaults, $attributes); $model = $this->find($id); if (!in_array('Esensi\\Model\\Contracts\\HashingModelInterface', class_implements($model))) { throw new Exception("User model must implement Esensi\\Model\\Contracts\\HashingModelInterface.\n Revert to 0.3.* or see upgrade guide for details."); } if (!array_key_exists('password', $attributes)) { $model->fill($attributes); if (Config::get('entrust-gui.confirmable') === true) { $model->password_confirmation = $model->password; } $model->saveWithoutHashing(); } else { $model = parent::update($attributes, $id); } $model->roles()->sync($attributes['roles']); return $this->parserResult($model); }
/** * @param array $data * @param $id * @return array|mixed */ public function update(array $data, $id) { return $this->repository->update($data, $id); }
/** * Update a user by id * * @throws ValidatorException * @param array $attributes * @param $id * @return mixed */ public function update(array $attributes, $id) { $attributes = $this->hashPassword($attributes); return parent::update($attributes, $id); }