code: public function updateChild($id, $relation, $idChild, array $data)
      {
          $parent = $this->model->find($id);
          
          if (! $parent) {
              return null;
          }
          
          $resource = $parent->$relation()->find($idChild);
          
          if (! $resource) {
              return null;
          }
          $resource->update($data);
          
          return $resource;
      }
docs: Update Child
  
  @return \Illuminate\Database\Eloquent\Model;