Revert "改名"

This reverts commit fdf58326
This commit is contained in:
2022-01-20 19:04:15 +08:00
parent b10ffd832a
commit 5aa5d3ea13
4 changed files with 24 additions and 21 deletions
+5 -8
View File
@@ -166,15 +166,12 @@ class Collection extends AbstractCollection
public function delete(): bool
{
$model = $this->getModel();
if (!$model->hasPrimary()) return false;
$ids = [];
foreach ($this as $item) {
$id = $item->getPrimaryValue();
if (!empty($id)) {
$ids[] = $id;
}
if ($model->hasPrimary()) {
$key = $model->getPrimary();
return $model::query()->whereIn($key, $this->column($key))->delete();
}
return $model::query()->whereIn($model->getPrimary(), $ids)->delete();
throw new Exception('Must set primary key. if you wante delete');
}
/**