Update the specified resource in storage.

@param Request $request
@param int     $id

@return Response
173138
public function update(RoleRequest $request, $id)
    {
        $input = $request->except('permissions');

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

        $record->syncPermissions($request->permissions);

        $record->update($input);

        $this->notify([
            'type' => 'success',
            'title' => 'Successful update!',
            'description' => 'This role is updated successfully.',
        ]);

        return redirect()->back();
    }
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();
    }
964149
public function update(Request $request, $id = null)
    {
        try {
            $application = $this->applications->save($request, $id);
            if ($request->has('theme')) {
                \Cookie::queue('soda-theme', $request->input('theme'));
                $request->session()->put('soda-theme', $request->input('theme'));
            }
        } catch (Exception $e) {
            return $this->handleException($e, trans('soda::errors.update', ['object' => 'application']));
        }

        return redirect()->route('soda.settings.edit', $application->getKey())->with('success', trans('soda::messages.updated', ['object' => 'application']));
    }
1179499
public function updateAction(Request $request, $id)
    {
        $response = ['error' => false];

        try {
            $this->get('ongr_translations.translation_manager')->edit($id, $request);
        } catch (\LogicException $e) {
            $response = ['error' => true];
        }

        return new JsonResponse($response);
    }
1290743
public function update($id, Request $request)
    {
        $this->validate($request, NavigationAdmin::$rules, NavigationAdmin::$messages);

        $inputs = $request->only([
            'icon',
            'title',
            'slug',
            'description',
            'help_index_title',
            'help_index_content',
            'help_create_title',
            'help_create_content',
            'help_edit_title',
            'help_edit_content',
            'parent_id',
            'url_parent_id'
        ]);
        $inputs['is_hidden'] = boolval($request->has('is_hidden'));

        $navigation = NavigationAdmin::findOrFail($id);
        $navigation = $this->updateEntry($navigation, $inputs);
        $navigation->updateUrl()->save();
        $navigation->roles()->sync(input('roles'));

        return redirect_to_resource();
    }
543789
public function updateAction(Request $request, $id)
    {
        $breadcumbs = $this->container->get('bacon_breadcrumbs');

        $breadcumbs->addItem(array(
            'title' => 'Language',
            'route' => 'admin_language',
        ));

        $breadcumbs->addItem(array(
            'title' => 'Edit',
            'route' => '',
        ));

        $entity = $this->getDoctrine()->getRepository('BaconLanguageBundle:Language')->find($id);

        if (!$entity) {

            $this->get('session')->getFlashBag()->add('message', array(
                'type' => 'error',
                'message' => 'Registry not Found',
            ));

            return $this->redirect($this->generateUrl('admin_language'));
        }

        $form = $this->createForm(new LanguageFormType(), $entity);
        $deleteForm = $this->createDeleteForm($id);

        $handler = new LanguageFormHandler(
            $form,
            $request,
            $this->getDoctrine()->getManager(),
            $this->get('session')->getFlashBag()
        );

        if ($handler->save()) {
            return $this->redirect($this->generateUrl('admin_language'));
        }

        return array(
            'entity'      => $entity,
            'form'        => $form->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
610895
public function update(BooksRequest $request, $id)
    {
        $book = $this->model->findOrFail($id);

        if (!$book->update($request->all())) {
            return json()->internalError('Failed to update !');
        }

        return json()->success('Updated');
    }
31031
public function update(Request $request, $id)
    {
        $this->model = $this->model->findOrFail($id);

        $request = $this->processRequest($request);

        if ($request === true) {
            return $this->redirection();
        }

        $this->validate($request, $this->model->rules());

        $this->model->update($request->all());

        $saved = $this->afterSaving($request);

        if ($saved) {
            return $this->redirection();
        }
    }
696407
public function update($id, Request $request)
    {
        $entity = $this->getEntityById($id);

        if (!$entity) {
            return $this->response(null, Response::HTTP_NOT_FOUND);
        }

        $params = $request->only($this->fillable);

        $result = $this->manager->update($entity, $params);

        if (!$result->ok()) {
            return $this->response(['errors' => $result->getSimpleErrors()], Response::HTTP_BAD_REQUEST);
        }

        return $this->response($this->serialize($result->getResource(), $request), Response::HTTP_OK);
    }
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');

  }
952277
public function update(Request $request, $id)
    {
        $validate_data_array = $request->all();
        $data = $this->config->getModel()::find($id);
        $data->fill($request->all());

        foreach ($this->config->rows as $row) {
            if ($row->fillable && ! isset($data->{$row->name})) {
                if ($row instanceof FormDate) {
                    $data->{$row->name} = $request->input('date', date('Y-m-d'));
                } else {
                    $data->{$row->name} = $request->input($row->name, $row->default);
                }
                $validate_data_array[$row->name] = $data->{$row->name};
            }
            if ($row instanceof FormCheckbox && empty($request->get($row->name, null))) {
                $data->{$row->name} = null;
            }
        }

        $validator = Validator::make($validate_data_array, $this->config->getValid($id));
        if ($validator->fails()) {
            return back()->withInput($request->except('password'))->withErrors($validator);
        }

        $data->save();
        event(new ComponentItemUpdated($this->config, $data, $request));
        MessageLarrock::success('Материал '.$request->input('title').' изменен');
        \Cache::flush();

        return back();
    }
1152351
public function update($id, Request $request)
    {
        $permission = Permission::findOrFail($id);

        $data = $request->all();
        $data['resource'] = $data['controller'] . '@' . $data['method'];

        $validator = Validator::make(
            $data,
            $this->getValidationRules()
        );

        if ($validator->fails()) {
            return back()->withErrors($validator->messages());
        }

        $permission->update($data);

        return redirect()->action('\Aginev\Acl\Http\Controllers\PermissionController@index')
                         ->with('success', trans('acl::permission.edit.updated'));
    }
379018
public function update($id, Request $request)
    {
        return $this->updateModel($this->model()->find($id), $request->all(), 'edit');
    }
989203
public function update(Request $request, $id)
    {
        $data = $request->all();

        return $this->processor->update($this, $id, $data);
    }
126291
public function update(Request $request, $id)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            "countryCode" => 'required|regex:/\d{1,2}/',
            "label" => "required|max:50",
            "phoneNumber" => 'required|regex:/\d{10}/',
        ]);
        $phone = Phone::findOrFail($id);
        $this->authorize('manage', $phone);
        $phone->country_code = $request->countryCode;
        $phone->label = $request->label;
        $phone->phone_number = $request->phoneNumber;
        $this->authorize('manage', $phone);
        $phone->save();
        return fractal($phone, new PhoneTransformer())
            ->withResourceName('phone')
            ->respond();

    }
613659
public function patchAction($id, Request $request)
    {
        $response = $this->getResponse();
        $model = $this->getModel();

        // Validate received data. On failure release the lock.
        try {
            // Check JSON Patch request
            $this->restUtils->checkJsonRequest($request, $response, $model);
            $this->restUtils->checkJsonPatchRequest(json_decode($request->getContent(), 1));

            // Find record && apply $ref converter
            $jsonDocument = $model->getSerialised($id, null);

            try {
                // Check if valid
                $this->jsonPatchValidator->validate($jsonDocument, $request->getContent());
                // Apply JSON patches
                $patch = new Patch($jsonDocument, $request->getContent());
                $patchedDocument = $patch->apply();
            } catch (\Exception $e) {
                throw new InvalidJsonPatchException($e->getMessage());
            }
        } catch (\Exception $e) {
            throw $e;
        }

        // if document hasn't changed, pass HTTP_NOT_MODIFIED and exit
        if ($jsonDocument == $patchedDocument) {
            $response->setStatusCode(Response::HTTP_NOT_MODIFIED);
            return $response;
        }

        // Validate result object
        $record = $this->restUtils->validateRequest($patchedDocument, $model);

        // Update object
        $this->getModel()->updateRecord($id, $record);

        // Set status response code
        $response->setStatusCode(Response::HTTP_OK);
        $response->headers->set(
            'Content-Location',
            $this->getRouter()->generate($this->restUtils->getRouteName($request), array('id' => $record->getId()))
        );

        return $response;
    }
39777
public function update(Request $request, $id)
    {
        // Decode the role id
        // $id = $this->decode($hash);

        // Validate the form data
        $result = $this->validate($request, [
            'name' => 'required',
            'slug' => 'required|alpha_dash|unique:roles,slug,'.$id,
        ]);

        // Fetch the role object
        $role = $this->roleRepository->findById($id);
        if (!$role) {
            if ($request->expectsJson()) {
                return response()->json("Invalid role.", 422);
            }
            session()->flash('error', 'Invalid role.');
            return redirect()->back()->withInput();
        }

        // Update the role
        $role->name = $request->get('name');
        $role->slug = $request->get('slug');

        // Cast permissions values to boolean
        $permissions = [];
        foreach ($request->get('permissions', []) as $permission => $value) {
            $permissions[$permission] = (bool)$value;
        }

        // Set the role permissions
        $role->permissions = $permissions;
        $role->save();

        // All done
        if ($request->expectsJson()) {
            return response()->json(['role' => $role], 200);
        }

        session()->flash('success', "Role '{$role->name}' has been updated.");
        return redirect()->route('roles.index');
    }