Update the specified resource in storage.

@param \TypiCMS\Modules\Menus\Models\Menu               $menu
@param \TypiCMS\Modules\Menus\Http\Requests\FormRequest $request

@return \Illuminate\Http\RedirectResponse
192083
public function update(Menu $menu, FormRequest $request)
    {
        $this->repository->update($request->id, $request->all());

        return $this->redirect($request, $menu);
    }
32645
public function updateAction(Request $request)
    {
        $formData = $this->decodeRequest($request);

        // dump current profile configuration (to know what to remove later)
        /** @var Facet[] $facets */
        $facets = $this->om->getRepository('ClarolineCoreBundle:Facet\Facet')->findAll();

        $this->om->startFlushSuite();

        // updates facets data
        $updatedFacets = [];
        foreach ($formData as $facetData) {
            $updated = $this->crud->update(
                'Claroline\CoreBundle\Entity\Facet\Facet',
                $facetData,
                [Options::DEEP_DESERIALIZE]
            );
            $updatedFacets[$updated->getId()] = $updated;
        }

        // removes deleted facets
        foreach ($facets as $facet) {
            if (empty($updatedFacets[$facet->getId()])) {
                $this->crud->delete($facet);
            }
        }

        $this->om->endFlushSuite();

        return new JsonResponse(
            $this->serializer->serialize()
        );
    }
1029067
public function update(Request $request, Menu $menu)
    {
        $menu->parent_id = $request->get('parent_id');
        $menu->title = $request->get('title');
        $menu->icon = $request->get('icon');
        $menu->permission_id = $request->get('permission_id');

        if ($menu->permission_id == null) {
            $menu->uri = null;
        }
        else {
            $menu->uri = $menu->permission->uri;
        }

        $menu->save() ? admin_toastr('修改成功') : admin_toastr('修改失败', 'danger');

        return redirect()->route('admin::menu.index');
    }
1202864
public function updateMenus(ServerRequestInterface $request): ResponseInterface
    {
        $modules = $this->module_service->findByInterface(ModuleMenuInterface::class, true);

        $this->updateStatus($modules, $request);
        $this->updateOrder($modules, 'menu_order', $request);
        $this->updateAccessLevel($modules, ModuleMenuInterface::class, $request);

        return redirect(route('menus'));
    }
581251
public function update(ArticleCategory $category, Request $request)
	{
		$this->validate($request, ArticleCategory::$rules, ArticleCategory::$messages);

        $this->updateEntry($category, $request->only('name'));

        return redirect_to_resource();
	}
1036148
public function addMenuItem(Request $request, array $item, MenuItem $menu)
    {
        $attributes = array();

        // if the menu item has a name, add it as a css class.
        if ($name = $item['name']) {
            $attributes['class'] = $name;
        }
        if (empty($item['path'])) {
            $uri = null;
        } elseif (preg_match('!^(?:https?://|mailto:)!', $item['path'])) {
            $uri = $item['path'];
        } else {
            $baseUrl = $request->getBaseUrl();
            $uri = $baseUrl . '/' . ltrim($item['path'], '/');
        }

        $menuItem = $menu->addChild(
            $item['id'],
            array(
                'uri' => $uri,
                'attributes' => $attributes,
                'label' => $item['title']
            )
        );

        if (!empty($item['json_data'])) {
            $item['json_data'] = @json_decode($item['json_data']);
        }

        $menuItem->setExtras($item);
        return $menuItem;
    }
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'));
    }
1261579
public function store(Request $request)
    {
        $menu = Menu::create($request->input());

        return $this->response()->item($menu, new MenuTransformer());
    }
310080
public function store(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Menu', 'create')) {
            return $this->noPermission();
        }

        // delete menu links from database
        if ($request->deletedMenuLinks) {
            $ids = [];
            foreach ($request->deletedMenuLinks as $menuLinkID){
                if (!strstr($menuLinkID, 'NEW')) {
                    $ids[] = $menuLinkID;
                }
            }
            MenuLink::whereIn('menuLinkID', $ids)->delete();
        }

        // create menu if it doesn't exist
        if (!$request->selectedMenuID) {
            $slug = self::generateSlug($request->selectedMenu['title'], 'menus', 'menuID');

            $menu = new Menu();
            $menu->title = $request->selectedMenu['title'];
            $menu->slug = $slug;
            $menu->isPrimary = 0;

            if($menu->save()) {
                $menuID = $menu->menuID;
            }else{
                throw new \Exception("New MenuLinks could not be saved. Please contact your administrator!");
            }
        }else{
            // update menu if it exists
            $menuID = $request->selectedMenuID;

            $menu = Menu::findOrFail($menuID);
            $menu->title = $request->selectedMenu['title'];

            if(!$menu->save()) {
                throw new \Exception("New MenuLinks could not be saved. Please contact your administrator!");
            }
        }

        // convert menu links from multidimension to one dimension array
        $this->convertTo1Dimension($request->menuLinkList);
        // prepare array for storing
        $this->prepareArrayForStore($request->menuLinkListAfterOrder, $this->tmpMenuLinkInfo, $menuID);

        $newMenuLinksID = [];
        // create the new menu links for the selected menu
        foreach($this->newMenuLinks as $menuLinkKey=>$menuLink){

            //if parent is a new link get his id from $newMenuLinksID
            $isParentNewLink = strstr($menuLink['parent'], 'NEW');
            if($isParentNewLink) {
                $menuLink['parent'] = $newMenuLinksID[$menuLink['parent']];
            }

            //we don't need these anymore
            if(isset($menuLink['menuLinkID'])) { unset($menuLink['menuLinkID']); 
            }
            if(isset($menuLink['routeList'])) { unset($menuLink['routeList']); 
            }
            if(isset($menuLink['href'])) { unset($menuLink['href']); 
            }
            if(isset($menuLink['belongsToData'])) { unset($menuLink['belongsToData']); 
            }

            $this->newMenuLinks[$menuLinkKey] = self::objectsToJson($menuLink);
        }

        // Fire event
        Event::fire('menuLink:creating', [$this->newMenuLinks, $request]);

        // insert menulinks
        $insertMenuLinks = DB::table('menu_links')->insert($this->newMenuLinks);

        if($insertMenuLinks) {
            // Fire event
            Event::fire('menuLink:created', [$insertMenuLinks, $request]);
        }else{
            throw new \Exception("New MenuLinks could not be saved. Please contact your administrator!");
        }

        // update links
        $existingMenuLinks = $this->setParentID($newMenuLinksID);
        foreach($existingMenuLinks as $menuLink){
            $menuLink = self::objectsToJson($menuLink);
            $menuLinkID = $menuLink['menuLinkID'];
            if(isset($menuLink['menuLinkID'])) { unset($menuLink['menuLinkID']); 
            }
            if(isset($menuLink['routeList'])) { unset($menuLink['routeList']); 
            }
            if(isset($menuLink['href'])) { unset($menuLink['href']); 
            }
            if(isset($menuLink['routes'])) { unset($menuLink['routes']); 
            }

            // Fire event
            Event::fire('menuLink:updating', [$menuLink, $request]);

            MenuLink::where('menuLinkID', $menuLinkID)->update($menuLink);

            // Fire event
            Event::fire('menuLink:updated', [$menuLink, $request]);
        }

        return $this->response('Menu is successfully saved', 200, $menuID);

    }
430596
public function update(Request $request)
    {
        $permission = Permission::findOrFail($request->permission_id);

        $permission->name = $request->name;

        $permission->update();

        return redirect('scaffold-permissions');
    }
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();
        }
    }
221940
public
    function update(Validator $request)
    {
        $init = new InitData($request);
        Model::quickUpdate($init->getDataForEdit());
        flash()->success('Your Item Updated');
        return redirect()->to(self::getScope().'/'.self::getModule($this));
    }
921288
public function update(Role $role, Request $request)
    {
        $this->validate($request, Role::$rules, Role::$messages);

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

        return redirect_to_resource();
    }
141334
public function update(Request $request)
    {
        $this->authorize('update', Settings::class);

        $this->validate($request, [
            'appname'     => 'required',
            'description' => 'required',
            'keywords'    => 'required',
            'author'      => 'required',
        ]);

        Settings::first()->update([
            'appname'       => $request->appname,
            'description'   => $request->description,
            'keywords'      => $request->keywords,
            'author'        => $request->author,
        ]);

        return redirect()->route('laralum::settings.index', ['p' => 'Settings'])->with('success', __('laralum_settings::general.updated_settings'));
    }
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'));
      }
1104154
public function update(User $user, FormRequest $request)
    {
        $data = $request->all();

        $userData = Arr::except($data, ['exit', 'permissions', 'roles', 'password_confirmation']);

        if (!isset($userData['password']) || $userData['password'] === '') {
            $userData = Arr::except($userData, 'password');
        } else {
            $userData['password'] = Hash::make($data['password']);
        }

        $roles = $data['roles'] ?? [];
        $permissions = $data['permissions'] ?? [];
        $user->roles()->sync($roles);
        $user->syncPermissions($permissions);

        $this->repository->update($user->id, $userData);

        return $this->redirect($request, $user);
    }
840246
public function update(Page $page, FormRequest $request)
    {
        $data = $request->all();
        $data['parent_id'] = $data['parent_id'] ?: null;
        $this->repository->update($page->id, $data);
        event('page.resetChildrenUri', [$page]);
        Menulinks::forgetCache();

        return $this->redirect($request, $page);
    }