Update the specified resource in storage.

@param UpdateInvitationRequest $request
@param $id
@return \Illuminate\Http\JsonResponse
3993
public function update(UpdateInvitationRequest $request, $id)
    {
        $invitation = UserInvitation::find($id);
        $invitation->update($request->intersect(['email','state','token']));
        return Response::json(['updated' => true ]);
    }
1173890
public function update(UserUpdateRequest $request, $id)
    {
        $input = $request->except('roles');

        if ($request->has('password')) {
            $input['password'] = bcrypt($request->password);
        } else {
            unset($input['password']);
        }

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

        if ($request->has('roles')) {
            $record->syncRoles($request->roles);
        }

        $record->update($input);

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

        return redirect()->back();
    }
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');
    }
604221
public function update(int $id, Request $request)
    {
        $attachment = Attachment::findOrFail($id)
            ->fill($request->all());

        $attachment->save();

        return response()->json($attachment);
    }
723376
public function update(Request $request, $id)
    {
        $this->validate(
            $request,
            [
                'key' => 'required|string|unique:settings,key,' . $id,
                'value' => 'required'
            ]
        );
        $requestData = $request->all();

        $setting = Setting::findOrFail($id);
        $setting->update($requestData);

        return redirect('admin/settings')->with('flash_message', 'Setting updated!');
    }
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;
    }
1038618
public function update(HCResourceAuthorRequest $request, string $id): JsonResponse
    {
        $record = $this->service->getRepository()->findOneBy(['id' => $id]);
        $record->update($request->getRecordData());

        if ($record) {
            $record = $this->service->getRepository()->find($id);

            event(new HCResourceAuthorUpdated($record));
        }

        return $this->response->success("Created");
    }
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;
    }
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]);
    }
1236237
public function update(Request $request, $id)
    {
        $abstract = sprintf('themosis.metabox.%s', $id);

        try {
            $metabox = $this->manager->saveFields(app($abstract), $request);
        } catch (\Exception $exception) {
            return response()->json([
                'message' => $exception->getMessage(),
                'errors' => true
            ], 500);
        }

        return response()->json($metabox->toArray());
    }
804827
public function update(SubmitRequest $request, $id = null)
    {
        $id = is_null($id) ? $request->input('id') : $id;
        $this->service->update($id, $request->except(['userType']));

        return $this->success();
    }
750613
public function update(Request $request, $id)
    {
        $this->validate($request, [
            'name'      => 'required',
            'color'     => 'required',
        ]);

        $priority = Priority::findOrFail($id);
        $priority->update(['name' => $request->name, 'color' => $request->color]);

        Session::flash('status', trans('ticketit::lang.priority-name-has-been-modified', ['name' => $request->name]));

        \Cache::forget('ticketit::priorities');

        return redirect()->action('\Kordy\Ticketit\Controllers\PrioritiesController@index');
    }
1159047
public function update(Request $request, $id)
    {
        $name = \Transliteration::clean_filename(strtolower($request->label));
        $label = $request->label;

        try
        {
          WorkflowState::where('id',$id)->update(['label' => $label, 'name' => $name]);
        }
        catch(\Illuminate\Database\QueryException $e){
            // do what you want here with $e->getMessage();
            return redirect()->route('state')->with('message', 'Error');
        }

        return redirect()->route('state')->with('message', 'Update data success');
    }
151997
public function update(Request $request, $id = null)
    {
        // validate
        $this->registerValidators();

        // check auth if update me
        if (!$id && !$this->checkAuth()) {
            return response()->json(null, 401);
        }

        // check user
        $user = $id ? AppUser::find($id) : Auth::user();

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

        $request->id = $id;
        // validate data
        $validator = Validator::make($request->all(), [
            'name'         => 'sometimes|required|max:255',
            'email'        => 'sometimes|required|email|max:255|unique:users,email,'.$user->id,
            'old_password' => 'sometimes|required|changePassword|min:6',
            'password'     => 'sometimes|required|changePassword|confirmed|min:6',
            'username'     => 'string|max:30',
            'country'      => 'string|max:100',
            'location'     => 'string|max:100',
            'biography'    => 'string|max:255',
            'occupation'   => 'string|max:255',
            'website'      => 'string|max:255',
            'image'        => 'string|max:255',
            'gender'       => 'integer',
            'birthday'     => 'date'
        ]);

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

        // Update profile
        $user = $user->update($request->all());

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

        return response()->json(arrayView('phpsoft.users::user/read', [
            'user' => $user
        ]), 200);
    }
658930
public function update(ProductRequest $request, $id)
    {
        $product = Product::find($id);
        $product->update($request->all());
        return new ProductResource($product);
    }
465083
public function update(Request $request, $id)
    {
        $notification = History::findOrFail($id);

        $notification->acknowledged = true;
        $notification->save();

        return redirect(route('eyewitness.dashboard').'#notifications')->withSuccess('The notification has been acknowledged.');
    }
1356848
public function update(UpdateRedirectRequest $request, $id)
    {
        $redirect = $this->redirect->findOrFail($id);
        $redirect->update($request->all());

        return redirect('admin/redirects');
    }