Update a category.

@return \Illuminate\Http\RedirectResponse
436312
public function updateCategory(Request $request)
    {
        $this->validate(
            $request,
            [
                'category_id'        => 'required|integer|exists:categories',
                'parent_category_id' => 'integer|exists:categories,category_id',
                'name'               => 'required',
                'slug'               => 'required',
            ]
        );

        $category = Category::find($request->input('category_id'));

        $parent = Category::find($request->input('parent_category_id'));

        if (in_array($request->input('parent_category_id'), $category->getDescendantIds())) {
            return redirect()->back()->withErrors(['parent_category_id' => trans('mustard::admin.category_parent_is_child')]);
        }

        $category->parent()->associate($parent);
        $category->name = $request->input('name');
        $category->slug = $request->input('slug');

        $category->save();

        return redirect()->back()->withStatus(trans('mustard::admin.category_updated'));
    }
135117
public function update(CategoriesRequest $request, Category $category)
    {
        $category->update(
            $request->all()
        );

        return redirect()->route('categories.edit', $category)->with(
            'status', trans('globals.success_text')
        );
    }
1212391
public function update(CategoryRequest $request, Category $category)
    {
        $category->update($request->all());
        return new CategoryResource($category);
    }
1310421
def update
      @category = Term.find(params[:id])
      @category.deal_with_cover(params[:has_cover_image])
      respond_to do |format|
        # deal with abnormalaties - update the structure url
        if @category.update_attributes(term_params)
          format.html { redirect_to edit_admin_term_path(@category), notice: I18n.t("controllers.admin.terms.update.flash.success", term: Term.get_type_of_term(params)) }
        else
          format.html {
            render action: "edit"
          }
        end

      end
    end
1225194
public function update(Redirect $redirect, UpdateRedirectRequest $request)
    {
        $this->authorize(RedirectsPolicy::PERMISSION_UPDATE);

        $redirect->update($request->getValidatedData());

        $this->transNotification('updated', [], $redirect->toArray());

        return redirect()->route('admin::seo.redirects.show', [$redirect]);
    }
596828
protected function update() {
		
		if(!is_null($this->callback)) {
			
			// Not using application/javascript for compatibility reasons with older browsers.
			$this->headers->set('Content-Type', 'text/javascript');
				
			return $this->setContent(sprintf('/**/%s(%s);', $this->callback, $this->data)); 

		}
		
		// set header only when there is none or when it equals 'text/javascript' (from a previous update with callback)
		// in order to not overwrite a custom definition

		if(!$this->headers->has('Content-Type') || $this->headers->get('Content-Type') === 'text/javascript') {
			$this->headers->set('Content-Type', 'application/json');
		}

		return $this->setContent($this->data);

	}
1225932
protected function addCategory()
    {
        $this->controlAccess('category_add');

        if ($this->category->add($this->getSubmitted())) {
            $url = "admin/content/category/{$this->data_category_group['category_group_id']}";
            $this->redirect($url, $this->text('Category has been added'), 'success');
        }

        $this->redirect('', $this->text('Category has not been added'), 'warning');
    }
1372918
public function updateUrl($model)
    {
        $this->url = '';
        $category = $this->eloqent()->where('id', $model->category_id)->first();

        if ($category) {
            $this->url = $this->getURLPrefix() . $category->url . '/' . $this->slug . $this->getURLPosfix();
        }

        return $this;
    }
1168971
public function update (Request $request , $id)
    {
        if ($category = $this->category->where('id' , $id)->first()) {

            foreach ($request->except(['_token']) as $key => $val) {
                if (Schema::hasColumn('categories' , $key))
                    $category->{$key} = $val;
            }

            $slug = new Slugger($this->modelType);
            $slug = $slug->updateSlug($category , $request->input('slug') , $request->input('title'));
            $category->slug = $slug;

            $category->save();
            return $category;
        } else
            throw new CategoryException(trans('Categories::category.error-message.categoryNotExist'));

    }
312836
protected function actionListCategory()
    {
        list($selected, $action, $value) = $this->getPostedAction();

        $updated = $deleted = 0;

        foreach ($selected as $category_id) {

            if ($action === 'status' && $this->access('category_edit')) {
                $updated += (int) $this->category->update($category_id, array('status' => $value));
            }

            if ($action === 'delete' && $this->access('category_delete')) {
                $deleted += (int) $this->category->delete($category_id);
            }
        }

        if ($updated > 0) {
            $message = $this->text('Updated %num item(s)', array('%num' => $updated));
            $this->setMessage($message, 'success');
        }

        if ($deleted > 0) {
            $message = $this->text('Deleted %num item(s)', array('%num' => $deleted));
            $this->setMessage($message, 'success');
        }
    }
538004
public function setCategory($product_category) {
		if(!$this->setModified('category', $product_category)->isModified()) {
			return $this;
		}
		$this->category = $product_category;
		return $this;
	}
471123
public function store(CategoryRequest $request)
    {   
        $this->repository->create($request->all());

        return redirect()->route('admin.category.index');
    }
1339955
protected function redirectAfterUpdate()
    {
        merchant_toastr(trans('merchant.update_succeeded'));

        $url = Input::get(Builder::PREVIOUS_URL_KEY) ?: $this->resource(-1);

        return redirect($url);
    }
486380
protected function dbUpdate($category, $key, $value)
    {
        $updated_by = \Yii::$app->user->getId();
        $this->getDb()->createCommand('
            UPDATE
                {{setting}}
            SET
                `value` = :value,
                `updated_at` = NOW(),
                `updated_by` = :updated_by
            WHERE
                category = :category
                AND `key` = :key
        ', compact('category', 'key', 'value', 'updated_by'))->execute();
    }
890010
private function update()
    {
        $db = new Db();

        //Insert into article table
        $row = $db->query('UPDATE article
                            SET   category = :category,
                                  author = :author,
                                  pubdate = :pubdate,
                                  editdate = :editdate,
                                  tags = :tags,
                                  status = :status,
                                  title = :title,
                                  media = :media,
                                  resume = :resume
                            WHERE id = :id',

                        [':id'=>$this->id,
                         ':category' => $this->category,
                         ':author' => $this->author,
                         ':pubdate' => $this->pubdate,
                         ':editdate' => $this->editdate,
                         ':tags' => $this->tags,
                         ':status' => $this->status,
                         ':title' => $this->title,
                         ':media' => $this->media,
                         ':resume' => $this->resume
                        ]);
        //check update
        if (!$row) {
            return false;
        }

        //Insert into content table
        $row = $db->query('UPDATE articlecontent
                            SET   editdate = :editdate,
                                  content = :content
                            WHERE article = :article',
                            
                        [':article' => $this->id,
                         ':editdate' => $this->editdate,
                         ':content' => $this->content]);
        return $row;

        
        $cols = '';
        $vals = [];
        foreach ($this as $k => $v) {
            if ($k == 'table' || $k == 'where') {
                continue;
            }echo '<br><b>'.$k.': </b>'.$v;
            if ($k !== 'id') {
                $cols .= $k.' = :'.$k.',';
            }
            $vals[':'.$k] = $v;
        }
        
        $cols = substr($cols, 0, -1); //tirando a ultima vírgula

        $where = ' WHERE id = :id ';
        if ($this->where != null) {
            $where .= ' and '.$this->where;
        }

        $db = new Db();
        return $db->query('UPDATE '.$this->table.' SET '.$cols.$where, $vals);
    }
653140
protected function update()
    {
        $this->preUpdate();
        $this->data = $this->api->update($this->id, $this->data);
        $this->postUpdate();

        return $this;
    }
762614
public function update($id)
    {
        try
        {
            $credentials = Input::except('groups');
            $credentials['groups'] = Input::get('groups', array());
            $credentials['id'] = $id;


            if( $this->userForm->update($credentials) )
            {
                return Redirect::route('cpanel.users.index')
                    ->with('success', Lang::get('cpanel::users.update_success'));
            }

            return Redirect::back()
                ->withInput()
                ->withErrors($this->userForm->getErrors());
        }
        catch ( UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                    ->with('error', $e->getMessage());
        }
    }