public function attachToUser(User $user, int $quantity = 1, ?Product $product = null): void
    {
        if (ModelHelper::hasRelation($this, 'users') && $this->users() instanceof BelongsToMany) {
            $this->users()->syncWithoutDetaching($user->getKey());
        } elseif (ModelHelper::hasRelation($user, $this->getTable()) && $user->{$this->getTable()}() instanceof BelongsToMany) {