Detach models from the relationship using a custom class.

@param  mixed  $ids
@return int
497676
protected function detachUsingCustomClass($ids)
    {
        $results = 0;

        foreach ($this->parseIds($ids) as $id) {
            $results += $this->newPivot([
                $this->foreignPivotKey => $this->parent->{$this->parentKey},
                $this->relatedPivotKey => $id,
            ], true)->delete();
        }

        return $results;
    }
324253
public static function deleteByIds($className, array $ids): ResultInterface
    {
        list($table, , $idColumn) = self::getTable($className);
        $instance = self::getInstance($className);

        $query = Query::table($table)->whereIn($idColumn, $ids)->selectInstance($instance);

        return $query->delete();
    }
1336461
private function executeDestroy($ids){

        $models = User::find($ids);

        User::destroy($ids);

        event(new UserRemoved($models->toJson()));

        return Response::json(['deleted' => true ]);
    }
708975
public function synchronize(array $ids): bool
	{
		$success = true;

		$keys = $this->getJunctionKeys($ids);

		// Fetch existing links

		$existing = $this->junction()->where($this->getForeignKey(), '=', $this->parent->getPrimaryKeyValue())->select([$this->getJunctionKey()])->all()->pluck($this->getJunctionKey());

		// Link new relations

		if(!empty($diff = array_diff($keys, $existing)))
		{
			$success = $success && $this->link($diff);
		}

		// Unlink old relations

		if(!empty($diff = array_diff($existing, $keys)))
		{
			$success = $success && $this->unlink($diff);
		}

		// Return status

		return $success;
	}
96556
public function findMany($ids, array $columns = ['*'])
    {
        if (empty($ids)) {
            return $this->model->newCollection();
        }

        $this->getBuilder()->whereIn($this->getModel()->getQualifiedKeyName(), $ids);

        return $this->get($columns);
    }
830445
public function delIndex($ids)
    {

        if (!$ids) {
            throw new \Exception('索引主键不能为空');
        }

        $this->getIndex()->del($ids);
        if ($this->config['flushIndex']) {
            $this->getIndex()->flushIndex();
        }
        return $this->getIndex();
    }
729280
public function delete($keys): int
    {
        if (!is_array($keys)) {
            $keys = [$keys];
        }
        return $this->handle->zRem($this->name, ...$keys);
    }
546979
public function untag($ids, $tags)
    {
        $namespace = $this->getNamespace() . '/tag';

        return $this->ontraport->delete($namespace, $this->toArray([
            'ids' => implode(',', (array) $ids),
            'remove_list' => implode(',', (array) $tags),
        ]));
    }
1148437
public function detach($ids = null, $touch = true)
    {
        $query = $this->newPivotQuery();

        // If associated IDs were passed to the method we will only delete those
        // associations, otherwise all of the association ties will be broken.
        // We'll return the numbers of affected rows when we do the deletes.
        if (! is_null($ids = $this->parseIds($ids))) {
            if (count((array) $ids) === 0) {
                return 0;
            }

            $query->whereIn($this->relatedKey, (array) $ids);
        }

        // Once we have all of the conditions set on the statement, we are ready
        // to run the delete on the pivot table. Then, if the touch parameter
        // is true, we will go ahead and touch all related models to sync.
        foreach ($query->cursor() as $result) {
            $result->delete();
        }

        if ($touch) {
            $this->touchIfTouching();
        }

        return 1;
    }
401490
public function getByIds(array $ids)
    {
        if (empty($ids)) {
            return null;
        }

        $parameters = array(
            'api_action' => 'list_list',
            'ids' => implode(',', $ids)
        );

        $response = $this->request($parameters);

        if ($response === null || $response->getStatusCode() !== 200) {
            return null;
        }

        $json = $response->getBody()->getContents();

        return $this->serializer->deserialize(
            $this->removeResultInformation($json),
            'array<integer, ' . \FondOfPHP\ActiveCampaign\DataTransferObject\MailingList::class . '>',
            'json'
        );
    }
121695
public function ids(array $ids = null) {
        if ($ids === null) {
            return $this->ids;
        }

        $this->ids = $ids;

        return $this;
    }
1015900
public function delete(array $ids)
    {
        if (!count($ids)) {
            return;
        }
        $ids_str = implode(',', $ids);
        $db = Db::obtain();
        $slots = $db->fetchArrayPDO(
            'SELECT id FROM ' . Db::realTablename('slots') . ' WHERE match_id IN (' . $ids_str . ')',
            array()
        );
        $slotsFormatted = array();
        foreach ($slots as $slot) {
            array_push($slotsFormatted, $slot['id']);
        }
        if (count($slotsFormatted)) {
            $slots_str = implode(',', $slotsFormatted);
            $db->exec('DELETE FROM ' . Db::realTablename('ability_upgrades') . ' WHERE slot_id IN (' . $slots_str . ')');
            $db->exec('DELETE FROM ' . Db::realTablename('additional_units') . ' WHERE slot_id IN (' . $slots_str . ')');
            $db->exec('DELETE FROM ' . Db::realTablename('slots') . ' WHERE id IN (' . $slots_str . ')');
        }
        $db->exec('DELETE FROM ' . Db::realTablename('picks_bans') . ' WHERE match_id IN (' . $ids_str . ')');
        $db->exec('DELETE FROM ' . Db::realTablename('matches') . ' WHERE match_id IN (' . $ids_str . ')');
    }
173245
public function itemsDelete($ids) {
		$db = BFactory::getDBO();
		if (empty($db)) {
			return false;
		}
		$qr = 'DELETE FROM `' . $this->tableName . '` WHERE (`' . $this->primaryKeyName . '` in (' . implode(',', $ids) . '))';
		$q = $db->Query($qr);
		if (empty($q)) {
			return false;
		}
		//TODO delete cache
		return true;
	}
700048
public function deleteMany(array $ids)
    {
        $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id';

        if (method_exists($this, 'beforeDelete')) {
            $this->beforeDelete();
        }

        $this->qb->whereIn($primaryKey, $ids);

        if ($this->qb->table($this->table)->delete()) {
            if (method_exists($this, 'afterDelete')) {
                return $this->afterDelete();
            }

            return $this->db->getAffectedRows();
        }

        return false;
    }
795701
public function remove($id)
    {
        // Support removing many ids at once
        $ids = Request::has('ids') ? explode(',', request('ids')) : [$id];

        // Get the model instances for each id, for the purpose of event firing
        $items = array_map(function ($id) {
            return $this->findOrFail($id);
        }, $ids);

        // Lookup up the parent model so we can bulk remove multiple of THIS model
        foreach ($items as $item) {
            $item->fireDecoyEvent('removing', [$item, $this->parent]);
        }
        $this->parentRelation()->detach($ids);
        foreach ($items as $item) {
            $item->fireDecoyEvent('removed', [$item, $this->parent]);
        }

        // Redirect.  We can use back cause this is never called from a "show"
        // page like get_delete is.
        if (Request::ajax()) {
            return Response::json();
        }

        return Redirect::back();
    }
481431
public function remove($ids)
    {
        if (!$this->isEmpty() &&
            ($remove = $this->_resolveIds($ids))) {
            $this->_ids = array_diff($this->_ids, array_unique($remove));
        }
    }
236863
public function load($ids)
    {
        settype($ids, 'array');

        $types = $this->getTypes();
        $libraries = $this->getList();

        foreach ($ids as $key => $id) {

            if ($this->isLoaded($id)) {
                unset($ids[$key]);
                continue;
            }

            if (empty($libraries[$id]['type'])) {
                unset($ids[$key]);
                continue;
            }

            if (empty($types[$libraries[$id]['type']]['load'])) {
                unset($ids[$key]);
            }
        }

        $sorted = $this->graph->sort($ids, $libraries);

        if (empty($sorted)) {
            return false;
        }

        foreach ($this->prepareFiles($sorted, $libraries) as $file) {
            require_once $file;
        }

        $this->loaded = array_merge($this->loaded, $sorted);
        return true;
    }