public function detach(array $ids, BelongsToMany $relation)
    {
        if (empty($ids)) {
            return;
        }

        $this->newPivotQuery($relation)
             ->whereIn($this->getRelatedPivotKeyName($relation), $ids)
             ->delete();
    }