Update the specified resource in storage.

@param Request $request
@param int     $id

@return Response
559875
public function update(Request $request, $id)
    {
        $this->validate($request, [
            'subject'     => 'required|min:3',
            'content'     => 'required|min:6',
            'priority_id' => 'required|exists:ticketit_priorities,id',
            'category_id' => 'required|exists:ticketit_categories,id',
            'status_id'   => 'required|exists:ticketit_statuses,id',
            'agent_id'    => 'required',
        ]);

        $ticket = $this->tickets->findOrFail($id);

        $ticket->subject = $request->subject;

        $ticket->setPurifiedContent($request->get('content'));

        $ticket->status_id = $request->status_id;
        $ticket->category_id = $request->category_id;
        $ticket->priority_id = $request->priority_id;

        if ($request->input('agent_id') == 'auto') {
            $ticket->autoSelectAgent();
        } else {
            $ticket->agent_id = $request->input('agent_id');
        }

        $ticket->save();

        session()->flash('status', trans('ticketit::lang.the-ticket-has-been-modified'));

        return redirect()->route(Setting::grab('main_route').'.show', $id);
    }
467207
public function deleteAction(Request $request, $id)
    {
        $locale = $this->getLocale($request);

        $delete = function ($id) use ($locale){
            $this->getManager()->delete($id, $this->getUser()->getId());
        };
        $view = $this->responseDelete($id, $delete);

        return $this->handleView($view);
    }
1354868
public function updateAction(Request $request, $id)
    {
        $this->registerBreadcrubms()->addItem($this->get("translator")->trans("Edit"));

        $entity = $this->getRepository()->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find ' . $this->getEntityName() . '.');
        }

        $form = $this->createEditForm($entity);

        $form->handleRequest($request);

        if ($form->isValid()) {
            /**
             * @var $em \Doctrine\ORM\EntityManager
             */
            $em = $this->getDoctrine()->getManager();

            try {
                if ($form->get("saveAndPublish")->isClicked()) {
                    $entity->setPublished(1);
                }
            } catch (OutOfBoundsException $e) {

            }

            if ($em->getUnitOfWork()->isScheduledForUpdate($entity)) {
                $this->get('session')->getFlashBag()->add('success', $this->getEntityName() . ' has been updated!');
            }

            $em->persist($entity);

            if (method_exists($entity, 'mergeNewTranslations')) {
                $entity->mergeNewTranslations();
            }

            $em->flush();

            if ($form->get("saveAndExit")->isClicked()) {
                return $this->redirect($this->generateUrl($this->getRouteName(), $this->getRouteParams()));
            } else {
                return $this->redirect($this->generateUrl($this->getRouteName() . 'Edit', $this->getRouteParams(['id' => $id])));
            }
        }

        return $this->render($this->getListTemplate() . ":edit.html.twig", [
            'entity' => $entity,
            'form' => $form->createView()
        ]);
    }
932746
public function update(Request $request, $id)
    {
        try {
            $this->permissionRepositoryInterface->update($request->all(), $id);
        } catch (FormValidationException $e) {
            Flash::error($e->getMessage());

            return redirect()
              ->route('permissions.edit', ['id' => $id])
              ->withErrors($e->getErrors())
              ->withInput();
        } catch (PermissionsException $e) {
            Flash::error($e->getMessage());

            return redirect()->route('permissions.index');
        }

        Flash::success(trans('dashboard::dashboard.flash.permission.edit.success'));

        return redirect()->route('permissions.edit', ['id' => $id]);
    }
78125
public function putUpdate(Request $request, $id) {
    $this->validate($request, isset($this->vocabulary->rules_create) ? $this->vocabulary->rules_create : $this->vocabulary->rules);

    $vocabulary = $this->vocabulary->findOrFail($id);
    $vocabulary->update(Input::only('name'));

    return Redirect::to(action('\Devfactory\Taxonomy\Controllers\TaxonomyController@getIndex'))->with('success', 'Updated');

  }
1117801
public function update($id,Request $request)
    {
        $package = Package::findOrfail($id);
    	
        $package->name = $request->name;
        
        $package->description = $request->description;
        
        $package->string_composer = $request->string_composer;
        $package->description_does_what = $request->description_does_what;
        $package->dashboard_URL = $request->dashboard_URL;
        $package->github_URL = $request->github_URL;

        
        $package->save();

        return redirect('package');
    }
670994
public function update($id, Request $request)
    {
        $routePermission = RoutePermission::find($id);

        if ($routePermission == null) {
            return response()->json(null, 404);
        }

        // validate
        $this->registerValidators();

        $validator = Validator::make($request->all(), [
            'route'         => 'sometimes|required|string|max:255|unique:route_permission,route,'.$id,
            'permissions'   => 'sometimes|required|array|max:255|rolePermission',
            'roles'         => 'sometimes|required|array|max:255|rolePermission'
        ]);

        if ($validator->fails()) {
            return response()->json(arrayView('phpsoft.users::errors/validation', [
                'errors' => $validator->errors()
            ]), 400);
        }

        $request['permissions'] = isset($request['permissions']) ?
            json_encode($request['permissions']) : $routePermission->permissions;
        $request['roles'] = isset($request['roles']) ?
            json_encode($request['roles']) : $routePermission->roles;

        // check current user is admin
        if (!(Auth::user() && Auth::user()->hasRole('admin'))) {
            return response()->json(null, 403);
        }

        // update permissions and roles for the route
        $routePermission = $routePermission->update($request->all());

        return response()->json(arrayView('phpsoft.users::routePermission/read', [
            'routePermission' => $routePermission
        ]), 200);
    }
1096764
public function putAction(Request $request, $id)
    {
        $this->checkAccess('PUT', $id);
        $resource = $this->getResourceManager()->find($id);
        return $this->processPut($request, $resource);
    }
418959
public function update(Request $request, $id = null)
    {
        /*
         * Update pagetypes
         * All, single, and mass updating
         */

        // Set roles that have access
        $request->user()->authorizeRoles(['admin']);

        // Set pagetypes to a collection
        $pagetypes = collect();

        if ($id && is_string($id)) {
            // Update 1 post according to id
            $pagetypes[] = PageType::findOrFail($id);
        } elseif ($id && is_array($id)) {
            // Update all in array
        } else {
            // Update all pagetypes from sources
            $pagetypes = self::getAllPagetypes();
        }

        foreach ($pagetypes as $pagetype) {

            if ($id && is_string($id)) {
                $existing_pagetype = PageType::findOrFail($pagetype->id)->first();
            } else {
                $existing_pagetype = PageType::where('model', get_class($pagetype))->first();
            }

            // Validate $pagetype content
            if (!$pagetype->name || !$pagetype->description) {
                dd($pagetype->model . ' was missing attributes for name or description');
            }

            // Check if it already exist in db, and update/save accordingly
            if (!$existing_pagetype) {
                // Get and set all required attributes
                $pagetype->model = get_class($pagetype);

                // Get declared fields
                if (method_exists($pagetype, 'setFields')) {
                    $pagetype->fields = $pagetype->setFields();
                }

                // Save
                $pagetype->save();
            } else {
                // Get and set all required attributes
                $existing_pagetype->name = $pagetype->name;
                $existing_pagetype->description = $pagetype->description;

                // Get new declared fields
                if (method_exists($pagetype, 'setFields')) {
                    $existing_pagetype->fields = $pagetype->setFields();
                }

                // Update
                $existing_pagetype->touch();
                $existing_pagetype->update();
            }
        }

        return back();
    }
1116936
public function putAction(Request $request, $id)
    {
        $language = $this->getLanguage($request);
        $action = $request->get('action');

        $this->checkActionParameterSecurity($action, $language, $id);

        $document = $this->getDocumentManager()->find(
            $id,
            $language,
            [
                'load_ghost_content' => false,
                'load_shadow_content' => false,
            ]
        );

        $formType = $this->getMetadataFactory()->getMetadataForClass(get_class($document))->getFormType();

        $this->get('sulu_hash.request_hash_checker')->checkHash($request, $document, $document->getUuid());

        $this->persistDocument($request, $formType, $document, $language);
        $this->handleActionParameter($action, $document, $language);
        $this->getDocumentManager()->flush();

        $context = new Context();
        $context->setGroups(['defaultPage']);

        return $this->handleView($this->view($document)->setContext($context));
    }
648962
public function updateFromRequest($id, Request $request)
    {
        $transUnit = $this->storage->getTransUnitById($id);

        if (!$transUnit) {
            throw new NotFoundHttpException(sprintf('No TransUnit found for "%s"', $id));
        }

        $translationsContent = array();
        foreach ($this->localeManager->getLocales() as $locale) {
            $translationsContent[$locale] = $request->request->get($locale);
        }

        $this->transUnitManager->updateTranslationsContent($transUnit, $translationsContent);

        if ($transUnit instanceof TransUnitDocument) {
            $transUnit->convertMongoTimestamp();
        }

        $this->storage->flush();

        return $transUnit;
    }
325927
public function update(Request $request, $id = null)
    {
        // validate data
        $validator = Validator::make($request->all(), [
            'name'         => 'sometimes|required|string|max:255|unique:permissions,name,'.$id,
            'display_name' => 'string|max:255',
            'description'  => 'max:1000'
        ]);

        if ($validator->fails()) {
            return response()->json(arrayView('phpsoft.users::errors/validation', [
                'errors' => $validator->errors()
            ]), 400);
        }

        // check permission
        $permission = Permission::find($id);

        if (!$permission) {
            return response()->json(null, 404);
        }

        // update permission
        $updatePermission = $permission->update($request->all());

        if (!$updatePermission) {
            return response()->json(null, 500); // @codeCoverageIgnore
        }

        return response()->json(arrayView('phpsoft.users::permission/read', [
            'permission' => $permission
        ]), 200);
    }
504346
public function update(Request $request, $id)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            'description' => 'max:256',
            'name' => 'required|max:32',
        ]);
        $memberTag = MemberTag::findOrFail($id);
        $this->authorize('update', $memberTag);
        if ($request->has('description')) {
            $memberTag->description = $request->description;
        }
        $memberTag->name = $request->name;
        $memberTag->save();
        return fractal($memberTag, new MemberTagTransformer())
            ->withResourceName('memberTag')
            ->respond();

    }
1181464
public function update(Request $request, $id)
    {
        $entry = $this->entriesRepository->getById($id, $this->resource);
        $this->validate($request, $this->validationRules($this->resource, $entry));

        $this->entriesRepository->update($id, $request, $this->resource);

        return redirect()->back()->with('success', 'Updated');
    }
866037
public function update(Request $request, $id)
    {
      if ( \Auth::user()->roles[0]->can('menu-update' ) ) {
        $input = $request->all();
        $input['url'] = "admin/".str_plural(Str::lower($input['name'] != 'Dashboard' ? $string=str_replace(" ","_", $input['name']) : ''));
        $menu = $this->menus->findOrFail($id);
        $menu->update($input);
        $menu->roles()->detach();
        foreach ($request->roles as $_id) {
          $role = Role::whereId($_id)->first();
          $menu->assign($role);
        }
        \Session::flash('flash_message', 'Menu updated!');
        return \Redirect::route('admin.menus.index', [
          ])->withMessage(trans('acl::menu.menus-controller-successfully_updated'));
        }
        return \Redirect::route('admin.menus.index')->withErrors(trans('acl::dashboard.unauthorized_access'));
      }
1363642
public function update($id, UpdateUserRequest $request)
    {
        $this->user->updatewithRoles($request->all(), $request->roles, $id);

        flash(trans('core::messages.resource.resource updated', ['name' => trans('user::users.title.user')]));

        return redirect()->route('backend::user.user.index');
    }
1008460
public function update(Request $request, $id)
    {
        /** @var \SymfonyId\AdminBundle\Configuration\ConfiguratorFactory $configuratorFactory */
        $configuratorFactory = $this->getConfiguratorFactory($this->getClassName());
        /** @var CrudConfigurator $crudConfigurator */
        $crudConfigurator = $configuratorFactory->getConfigurator(CrudConfigurator::class);

        $this->isGrantedOr404Error($crudConfigurator, Constants::ACTION_UPDATE);

        /** @var ModelInterface $model */
        $model = $this->findOr404Error($id);
        $form = $crudConfigurator->getForm($model, 'PUT');

        return $this->save($request, $form, $crudConfigurator);
    }