Update the specific post in the db
PUT /{table}/{id}

@param  Request   $request
@return Response
330729
public function update(Request $request) {

	    // Grab these inputs to determine if we need to return to the edit form after updating
        $return_to_edit = $request->input('return_to_edit');
        $record_id      = $request->input('id');

        // Launch the command, and capture the results (I should refactor "$response", but have not yet!)
        $response = $this->dispatchFrom(UpdateBaseCommand::class, $request);

        Session::flash('status_code', $response['status_code'] );


        ///////////////////////////////////////////////////////////////
        //              Problems with the update                     //
        ///////////////////////////////////////////////////////////////
        //        Session::flash('message', $message);

        if ($response['status_text'] == "validation_failed")
        {
            // flash message
            if (is_object($response['errorMessages'])) {
                Session::flash('message', $response['errorMessages']->first());
            } else {
                Session::flash('message', $response['errorMessages']);
            }

            // Return to the edit form with error messages
            return Redirect::back()
                ->withInput($response['data'])
                ->withErrors($response['errorMessages']);
        }


        if ($response['status_text'] == "persist_failed")
        {
            $message = "Persist failed. It does not happen often, but Laravel's save failed. The database operation is called at Lasallecms\Lasallecmsapi\\".$this->model->table."\\".$this->model->classname_formprocessor_delete.". MySQL probably hiccupped, so probably just try again.";

            Session::flash('message', $message);

            // Return to the edit form with error messages
            return Redirect::back()
                ->withInput($response['data']);
        }



        ///////////////////////////////////////////////////////////////
        //                  Update Succeeded!                        //
        ///////////////////////////////////////////////////////////////

        if ( empty($response['data']['title']) ) {
             $response['data']['title'] = strtoupper($response['data']['composite_title']);
        }

        ///////////////////////////////////////////////////////////////
        //                     Event?                                //
        ///////////////////////////////////////////////////////////////

        // if there is an event to fire where need to show an "are you sure" confirmation first
        if ($response['status_text'] == "update_successful_now_confirm_before_firing_event") {

            $message =  "You successfully updated the ".strtolower($this->model->model_class)." ".strtoupper($response['data']['title'])."!";

            Session::flash('message', $message);

            return view('lasallecrmlistmanagement::confirmations.confirm_send_to_list', [
                'user'                 => Auth::user(),
                'data'                 => $response['data'],
                'message'              => $message,
                'HTMLHelper'           => HTMLHelper::class,
            ]);
        }

        // if there is an event to fire with *no* "are you sure" confirmation first
        if ($response['status_text'] == "update_successful_with_event_fired") {

            $message =  "You successfully updated the ".strtolower($this->model->model_class)." ".strtoupper($response['data']['title'])." *and* ".$response['data']['eventDescription']."!";

            Session::flash('message', $message);
        }

        ///////////////////////////////////////////////////////////////
        //                     Redirect                              //
        ///////////////////////////////////////////////////////////////

        // Redirect to the edit form?
        if ($return_to_edit == "Save & Edit") {
            return Redirect::route('admin.'.$this->model->resource_route_name.'.edit', $record_id);
        }

        return Redirect::route('admin.'.$this->model->resource_route_name.'.index');
    }
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');
    }
989203
public function update(Request $request, $id)
    {
        $data = $request->all();

        return $this->processor->update($this, $id, $data);
    }
109842
public function update(Request $request, $id)
    {
        $this->validate($request, [
			'title' => 'required',
			'content' => 'required'
		]);
        $requestData = $request->all();
        
        $page = Page::findOrFail($id);
        $page->update($requestData);

        return redirect('admin/pages')->with('flash_message', 'Page updated!');
    }
1176238
public function updateAction(Request $request)
    {
        $form = $this->buildForm(null, $this->find($action = 'update'));

        if (in_array($request->getMethod(), ['POST', 'PUT', 'PATCH'], true)
            && $this->submitForm($form, $request)->isValid()) {
            try {
                $this->getDomainManager()->update($form->getData());
            } catch (DomainException $e) {
                $this->processException($e);
            }
        }

        return $this->processAction($action, $form);
    }
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'));
    }
133610
public function update(Request $request)
    {
        $data = array_get($request->input(), '2fa', []);
        return $this->processor->update($this, $data);
    }
1331165
public function update(Request $request)
    {
        $role = Role::findOrFail($request->role_id);

        $role->name = $request->name;

        $role->update();

        return redirect('scaffold-roles');
    }
1187545
public function update(Request $request, $id)
    {
        if ($request->input('action') == 'update_account') {
            try {
                $this->userRepositoryInterface->update($request->all(), $id);
            } catch (FormValidationException $e) {
                Flash::error($e->getMessage());

                return redirect()
                  ->route('account.edit')
                  ->withErrors($e->getErrors())
                  ->withInput();
            } catch (UsersException $e) {
                Flash::error($e->getMessage());

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

            Flash::success(trans('dashboard::dashboard.flash.account.success'));

            return redirect()->route('account.edit');
        }

        if ($request->input('action') == 'change_password') {
            try {
                $this->userRepositoryInterface->updatePassword($request->all());
            } catch (FormValidationException $e) {
                Flash::error($e->getMessage());

                return redirect()
                  ->route('account.edit')
                  ->withErrors($e->getErrors());
            } catch (AuthenticationException $e) {
                Flash::error(trans('dashboard::dashboard.flash.password.fail'));

                return redirect()
                  ->route('account.edit');
            }

            Flash::success(trans('dashboard::dashboard.flash.password.success'));

            return redirect()->route('account.edit');
        }
    }
114868
public function update(Request $request) {

        // Mark this email as read
        $this->repository->markEmailAsRead($request->input('id'));

        // Get a washed array of the create form's input fields
        $data = $this->adminEmailProcessing->washCreateForm($request);

        // Validate the create form's input fields
        $validator = $this->adminEmailProcessing->validateCreateForm($data);

        // Did validate pass or fail?
        if ($validator->fails()) {

            // unlock the record
            $this->repository->unpopulateLockFields($request->input('id'));

            return redirect('admin/emailhandling/'.$request->input('id').'/edit')
                ->withErrors($validator)
                ->withInput()
            ;
        }

        // Populate the fields
        $data = $this->adminEmailProcessing->populateUpdateFields($data);

        // UPDATE the record
        $savedOk = $this->repository->updateNewRecord($data);

        $message =  "You successfully updated your email message!";

        if ($request->input('send_email') == "Save & Send") {
            $message = "You successfully updated, and sent, your email message!";
        }

        $status_code = 200;

        if (!$savedOk) {
            $message     =  "There was a problem updating your email message!";
            $status_code = 400;
        }

        Session::flash('message',     $message);
        Session::flash('status_code', $status_code );

        if (!$savedOk) {

            // unlock the record
            $this->repository->unpopulateLockFields($request->input('id'));

            return redirect('admin/emailhandling/'.$request->input('id').'/edit')
                ->withInput()
            ;
        }


        if ($request->input('send_email') == "Save & Send") {

            // send the email
            $this->adminEmailProcessing->sendEmail($request->input('id'));

            // mark email as sent
            $this->repository->markEmailAsSent($request->input('id'));
        }

        return Redirect::route('admin.emailhandling.index');
    }
142230
public function update($request) {
        $this->resolveModel();
        $model = Dir::apiModel($this->model);
        $modelFind = $model::find($request->id);

        if(!empty($request->relationalModel)) {
            $idRelationalModel = trim(strtolower($request->relationalModel), 's');
            $idRelationalModel =  $idRelationalModel.'Id';
            if($modelFind->$idRelationalModel != $request->idRelational) killer('400');
        }

        foreach($modelFind->getTuples() as $tuple)
            if(!empty($request->$tuple))
                $modelFind->$tuple = $request->$tuple;

        $modelFind->update();
        return $modelFind;
    }
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);
    }
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]);
    }
144952
public function updateAction(Request $request): Response
    {
        $form = $this->formFactory->updateLocation();
        $form->handleRequest($request);

        $location = $form->getData()->getLocation();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LocationUpdateData $data) {
                $location = $data->getLocation();

                $locationUpdateStruct = new LocationUpdateStruct(['sortField' => $data->getSortField(), 'sortOrder' => $data->getSortOrder()]);
                $this->locationService->updateLocation($location, $locationUpdateStruct);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Location '%name%' updated.") */
                        'location.update.success',
                        ['%name%' => $location->getContentInfo()->name],
                        'location'
                    )
                );

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                        'locationId' => $location->getContentInfo()->mainLocationId,
                        '_fragment' => DetailsTab::URI_FRAGMENT,
                    ]));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $location->getContentInfo()->mainLocationId,
            '_fragment' => DetailsTab::URI_FRAGMENT,
        ]));
    }
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());
    }
1221526
public function update(Request $request, $id)
    {
        $this->validate($request, ['name' => 'required']);

        $role = Role::findOrFail($id);
        $role->update($request->all());
        $role->permissions()->detach();

        if ($request->has('permissions')) {
            foreach ($request->permissions as $permission_name) {
                $permission = Permission::whereName($permission_name)->first();
                $role->givePermissionTo($permission);
            }
        }

        return redirect('admin/roles')->with('flash_message', 'Role updated!');
    }
1225554
public function update(Request $request, $id)
    {
      $user = $this->users->findOrFail($id);
      $input = $request->all();
      $input['password'] = Hash::make($input['password']);
      $user->update($input);
      return \Redirect::route('admin.users.index', [
        ])->withMessage(trans('acl::user.users-controller-successfully_updated'));
      }