code: public function update($id, UpdateUserRequest $request)
      {
          /** @var \Unite\UnisysApi\Models\User $object */
          if(!$object = $this->repository->find($id)) {
              abort(404);
          }
  
          $this->authorize('update', $object);
  
          $data = $request->all();
  
          $object->update($data);
          $object->roles()->sync( $request->get('roles_id') ?: [] );
  
          \Cache::tags('response')->flush();
  
          return $this->successJsonResponse();
      }
docs: Update
  
  @param $id
  @param UpdateUserRequest $request
  
  @return \Illuminate\Http\JsonResponse