Update the specified resource in storage.

@param  \Illuminate\Http\Request  $request
@param  int  $id
@return \Illuminate\Http\Response
346376
public function update(Request $request, $id)
    {
        $item = LBSM_item::findOrFail($id);
        $item->fill($request->all());

        if ($request->parent_id != -1)
        {
            $item->parent_id = $request->parent_id;
        }
        else
        {
            $item->parent_id = null;
        }

        if ($request->roles)
        {
            $item->roles()->sync($request->roles);
        }

        if ($request->permissions)
        {
            $item->permissions()->sync($request->permissions);
        }

        $item->save();
        
        return redirect(url("/lbsm/item"));
    }
1134711
public function update(Request $request, $id)
    {
        $this->validate(
            $request,
            [
                'name' => 'required',
                'email' => 'required|string|max:255|email|unique:users,email,' . $id,
                'roles' => 'required'
            ]
        );

        $data = $request->except('password');
        if ($request->has('password')) {
            $data['password'] = bcrypt($request->password);
        }

        $user = User::findOrFail($id);
        $user->update($data);

        $user->roles()->detach();
        foreach ($request->roles as $role) {
            $user->assignRole($role);
        }

        return redirect('admin/users')->with('flash_message', 'User updated!');
    }
1249948
public function update(Request $request, $id)
    {
	    $rules = [
		    'titulo' => 'required|unique:categorias,titulo,'.$id,
		    'publicar' => 'required'
	    ];

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

        $url = SlugUrl($request->input('titulo'));

        $row = $this->categoriaRepo->findOrFail($id);
        $row->slug_url = $url;
        $this->categoriaRepo->update($row, $request->all());

        flash()->success('El registro se actualizó satisfactoriamente');

        return redirect()->route('admin.categorias.index');
    }
1096764
public function putAction(Request $request, $id)
    {
        $this->checkAccess('PUT', $id);
        $resource = $this->getResourceManager()->find($id);
        return $this->processPut($request, $resource);
    }
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');
    }
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');
    }
269666
public function update($id, UpdateUploadRequest $request)
    {
        $upload = $this->repository->find($id);

        if (empty($upload)) {
            return $this->sendError('Upload not found');
        }
        $all = $request->all();

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

        return $this->sendResponse($upload, 'Upload updated successfully.');
    }
733627
public function update(Request $request, $id)
    {
        $job = Job::findOrFail($id);
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            'locationId' => 'exists:' . config('combine-core.tablePrefix', 'combine') . '_locations,id',
            'memberIds.*' => 'required|exists:' . config('combine-core.tablePrefix', 'combine') . '_members,id',
            'memberTagIds.*' => 'required|exists:' . config('combine-core.tablePrefix', 'combine') . '_member_tags,id',
            'start' => 'required|date',
        ]);
        $job->start = Carbon::parse($request->start);
        $job->location_id = $request->locationId;
        $this->authorize('manage', $job);
        $job->save();
        /** @noinspection PhpUndefinedMethodInspection */
        $job->members()->sync($request->memberIds);
        /** @noinspection PhpUndefinedMethodInspection */
        $job->member_tags()->sync($request->memberTagIds);
        return fractal($job, new JobTransformer())
            ->withResourceName('job')
            ->respond();
    }
1175114
public function update($id, Request $request)
    {
        $user = UserProfile::whereUserId($id)->first();

        $rules = [
            'nombre' => 'required',
            'apellidos' => 'required'
        ];

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

        $user->fill($request->all());
        $user->save();

        //MENSAJE
        flash()->success('El registro se actualizó satisfactoriamente.');

        //REDIRECCIONAR A PAGINA PARA VER DATOS
        return redirect()->route('admin.user.index');
    }
413144
public function putAction(Request $request, $id)
    {
        $jsonData = $request->getContent();
        $data = json_decode($jsonData, true);

        // Id should be taken of request uri.
        $data['id'] = $id;

        $targetGroup = $this->deserializeData(json_encode($data));
        $targetGroup = $this->getTargetGroupRepository()->save($targetGroup);
        $this->getEntityManager()->flush();

        return $this->handleView($this->view($targetGroup));
    }
856823
public function update(Request $request, $id)
    {
        $this->validate($request, [
            'title' => 'required|min:2',
            'description' => 'min:2',
            'deprecated' => 'boolean',
        ]);

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

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

        return json()->success('Updated');
    }
113291
public function update(Update $request, $id)
    {
        try {
            $data = !$request->has('password') ? $request->except('password') : $this->inputAll();

            $user = $this->repository->findById($id);

            $user->update($data);

            $user->roles()->sync((array) \Input::get('role'));

            return $this->redirect('users.index');
        } catch (ModelNotFoundException $e) {
            return $this->redirectNotFound();
        }
    }
684694
public function update($page, $id, UpdateRequest $request)
    {
        $this->authorize('update', $eloquent = app('scaffold.model'));

        try {
            app('scaffold.actions')->exec('save', [$eloquent, $request]);
        } catch (\Exception $e) {
            return back()->withErrors([$e->getMessage()]);
        }

        return $this->redirectTo($page, $id, $request)
            ->with('messages', [
                trans('administrator::messages.update_success',
                    ['item' => app('scaffold.module')->singular()]
                )
            ]);
    }
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();
    }
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]);
    }
700611
public function update(Request $request, $id)
    {
        $node = Menu::where('id', $id)->first();

        $this->moveNode($request, $node);
        $this->updateNode($request, $node);

        return $this->response()->item($node, new NodeTransformer());
    }
1356848
public function update(UpdateRedirectRequest $request, $id)
    {
        $redirect = $this->redirect->findOrFail($id);
        $redirect->update($request->all());

        return redirect('admin/redirects');
    }