code: public function update(UserRequest $request, $id)
      {
          $user = User::findOrFail($id);
          if($request->get('password') && ( bcrypt($request->get('old_password')) == $user->password)) {
              $request['password'] = bcrypt($request->get('password'));
          } elseif(!$request->get('password')) {
              $request['password'] = $user->password;
          } else {
              return redirect()->back()->withInput()->withErrors(['password' => 'The given password is not correct.']);
          }
          $user->update($request->only($user->getFillable()));
          $user->roles()->sync(collect($request->get('role'))->all());
  
          return redirect()->route('user.manager.index');
      }
docs: Update the specified resource in storage.
  
  @param  UserRequest  $request
  @param  int  $id
  @return Response