Update role action
@param  Request $request
@return Response
331197
public function update(Request $request, $id = null)
    {
        // validate data
        $validator = Validator::make($request->all(), [
            'name'         => 'sometimes|required|string|max:255|unique:roles,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 role
        $role = Role::find($id);

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

        // update role
        $updateRole = $role->update($request->all());

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

        return response()->json(arrayView('phpsoft.users::role/read', [
            'role' => $role
        ]), 200);
    }
133610
public function update(Request $request)
    {
        $data = array_get($request->input(), '2fa', []);
        return $this->processor->update($this, $data);
    }
564764
public static function update($request, $match)
    {
        $model = Pluf_Shortcuts_GetObjectOr404('User_Role', $match['id']);
        $form = Pluf_Shortcuts_GetFormForUpdateModel($model, $request->REQUEST, array());
        $model = $form->save();
        $request->user->setMessage(sprintf(__('Role data has been updated.'), (string) $model));
        return new Pluf_HTTP_Response_Json($model);
    }
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'));
      }
619251
public function update($id, UpdateRoleRequest $request)
    {
        $role = $this->repository->findWithoutFail($id);

        if (empty($role)) {
            return $this->sendError('Role not found');
        }

        $role = $this->repository->update($request->all(), $id);
        $role->load($request->getWith());

        return $this->sendResponse($role, 'Role updated successfully.');
    }
247970
public function update(Request $request)
    {
        if ($request->has('notification')) {
            foreach ($request->notification as $id => $severity) {
                if (in_array(strtolower($severity), ['low', 'medium', 'high', 'disabled'])) {
                    Severity::where('id', $id)->update(['severity' => strtolower($severity)]);
                }
            }
        }

        return redirect(route('eyewitness.settings.index').'#severity')->withSuccess('The notification severity settings have been updated.');
    }
112818
public function update($id, RolesRequest $request)
    {
        $data = $this->mergeRequestWithPermissions($request);

        $this->role->updateAndSyncUsers($id, $data, $request->users);

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

        return redirect()->route('backend::user.role.index');
    }
1213824
public function store(Request $request)
    {
        $this->validate($request, ['name' => 'required']);

        $role = Role::create($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 added!');
    }
1306974
public function update(Request $request) {
        $response = $this->dispatchFrom(UpdateUserCommand::class, $request);

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

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

            // 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\Users\UpdateUserFormProcessing. 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']);
        }


        $name = strtoupper($response['data']['name']);
        $message = 'Your "'.$name.'" user updated successfully!';
        Session::flash('message', $message);
        return Redirect::route('admin.users.index');
    }
466299
public function updateVisibilityAction(Request $request): Response
    {
        $form = $this->createForm(ContentVisibilityUpdateType::class);
        $form->handleRequest($request);
        $result = null;

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ContentVisibilityUpdateData $data) {
                $contentInfo = $data->getContentInfo();
                $desiredVisibility = $data->getVisible();
                $location = $data->getLocation();

                if ($contentInfo->isHidden && $desiredVisibility === false) {
                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Content '%name%' was already hidden.") */
                            'content.hide.already_hidden',
                            ['%name%' => $contentInfo->name],
                            'content'
                        )
                    );
                }

                if (!$contentInfo->isHidden && $desiredVisibility === true) {
                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Content '%name%' was already visible.") */
                            'content.reveal.already_visible',
                            ['%name%' => $contentInfo->name],
                            'content'
                        )
                    );
                }

                if (!$contentInfo->isHidden && $desiredVisibility === false) {
                    $this->contentService->hideContent($contentInfo);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Content '%name%' has been hidden.") */
                            'content.hide.success',
                            ['%name%' => $contentInfo->name],
                            'content'
                        )
                    );
                }

                if ($contentInfo->isHidden && $desiredVisibility === true) {
                    $this->contentService->revealContent($contentInfo);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Content '%name%' has been revealed.") */
                            'content.reveal.success',
                            ['%name%' => $contentInfo->name],
                            'content'
                        )
                    );
                }

                return $location === null ? $this->redirectToRoute('ezplatform.dashboard') : $this->redirectToLocation($location);
            });
        }

        return $result instanceof Response ? $result : $this->redirectToRoute('ezplatform.dashboard');
    }
894140
public function updateAction(Request $request)
    {
        $schemaAlias = $request->attributes->get('schema');

        $this->isGrantedOr403($schemaAlias);

        $settingsManager = $this->getSettingsManager();
        $settings = $settingsManager->load($schemaAlias);

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

        $form = $this
            ->getSettingsFormFactory()
            ->create($schemaAlias, $settings, $isApiRequest ? ['csrf_protection' => false] : [])
        ;

        if ($form->handleRequest($request)->isValid()) {
            $messageType = 'success';
            try {
                $settingsManager->save($settings);
                $message = $this->getTranslator()->trans('sylius.settings.update', [], 'flashes');
            } catch (ValidatorException $exception) {
                $message = $this->getTranslator()->trans($exception->getMessage(), [], 'validators');
                $messageType = 'error';
            }

            if ($isApiRequest) {
                return $this->handleView($this->view(null, Response::HTTP_NO_CONTENT));
            }

            $request->getSession()->getBag('flashes')->add($messageType, $message);

            if ($request->headers->has('referer')) {
                return $this->redirect($request->headers->get('referer'));
            }
        }

        return $this->render($request->attributes->get('template', 'SyliusSettingsBundle:Settings:update.html.twig'), [
            'settings' => $settings,
            'form' => $form->createView(),
        ]);
    }
920394
public function updateAccount(Request $request)
    {
        $this->validator($request->all())->validate();

        $user = Auth::user();
        $user->name = $request->input('name');
        $user->email = $request->input('email');

        if ($request->input('password') !== null) {
            $user->password = bcrypt($request->input('password'));
        }

        $user->save();

        return redirect()
            ->route('voyager-frontend.account')
            ->with([
                'message' => __('Account Updated'),
                'alert-type' => 'success',
            ]);
    }
921288
public function update(Role $role, Request $request)
    {
        $this->validate($request, Role::$rules, Role::$messages);

        $this->updateEntry($role, $request->all());

        return redirect_to_resource();
    }
398805
public function update(Request $request)
    {
        if (!$request->has('password')) {
            $this->validator->setData($request->except(['password', 'password_confirmation']));
        }

        $user = $this->userRepo->getById($request->user()->id);
        $this->authorize('update', $user);
        $input = $this->validator->bind('nick', ['user_id' => $user->id])->bind('email', ['user_id' => $user->id])
            ->validate('update');
        $user  = $this->userRepo->update($user, $input);
        return $this->respondWithSuccess($user, new UserTransformer());
    }
360736
public function update(Request $request)
    {
        $this->validate($request, [
            'navbar_color' => 'max:255',
            'favicon'      => 'url|max:2000',
        ]);
        Customization::first()->update([
            // 'color'             => $request->input('color'),
            // 'background_color'  => $request->input('background_color'),
            'navbar_color'      => $request->navbar_color,
            'favicon'           => $request->favicon,
        ]);

        return redirect()->route('laralum::settings.index', ['p' => 'Customization'])->with('success', __('laralum_customization::general.updated_settings'));
    }
203935
public function update(Update $request, $id)
    {
        try {
            $role = $this->repository->findById($id);

            $data = $request->all();

            $role->update($data);

            if ($role->permissions->count()) {
                $role->permissions()->detach($role->permissions->lists('id')->toArray());

                $role->permissions()->attach(\Input::get('permissions'));
            }

            if ($role->permissions->count() == 0 && count(\Input::get('permissions')) > 0) {
                $role->permissions()->attach(\Input::get('permissions'));
            }

            return $this->redirect('roles.index');
        } catch (ModelNotFoundException $e) {
            return $this->redirectNotFound();
        }
    }
1287830
public function update(Request $request, FormBuilder $formBuilder, $page)
    {
        // Set roles that have access
        $request->user()->authorizeRoles(['admin', 'editor']);

        // Get page
        $page = Page::withTrashed()->findOrFail($page);

        // Get pagetype, or fail..
        $pagetype = PageType::where('model', $page->pagetype_model)->first();

        // Get fields
        $fields = $pagetype->fields ?: [];

        // Build the form
        $form = $formBuilder->createByArray($fields, [
            'method' => 'POST',
            'url' => route('admin.pages.page.store'),
            'name' => 'content'
        ]);

        // It will automatically use current request, get the rules, and do the validation
        if (!$form->isValid()) {
            return redirect()->back()->withErrors($form->getErrors())->withInput();
        }

        // Page data
        $page->title = $request->input('title');
        $page->content = $request->input('content');
        $page->status = $request->input('status') ? 2 : 1;

        $page->update();

        flash('The page was successfully updated')->success();

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