Skip to content

Commit 3354b55

Browse files
donjan-dengDonjan
andauthored
perf: Improve performance
Co-authored-by: Donjan <[email protected]>
1 parent be8f709 commit 3354b55

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/Adapters/DatabaseAdapter.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,7 @@ public function removePolicy(string $sec, string $ptype, array $rule): void
154154
$instance->where('v'.strval($key), $value);
155155
}
156156

157-
foreach ($instance->get() as $model) {
158-
if ($model->delete()) {
159-
++$count;
160-
}
161-
}
157+
$instance->delete();
162158
}
163159

164160
/**
@@ -210,11 +206,7 @@ public function removeFilteredPolicy(string $sec, string $ptype, int $fieldIndex
210206
}
211207
}
212208

213-
foreach ($instance->get() as $model) {
214-
if ($model->delete()) {
215-
++$count;
216-
}
217-
}
209+
$instance->delete();
218210
}
219211

220212
/**

0 commit comments

Comments
 (0)