Skip to content

Commit

Permalink
perf: Improve performance
Browse files Browse the repository at this point in the history
Co-authored-by: Donjan <Donjan@cqbaobao.cn>
  • Loading branch information
donjan-deng and Donjan committed Apr 25, 2021
1 parent be8f709 commit 3354b55
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/Adapters/DatabaseAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,7 @@ public function removePolicy(string $sec, string $ptype, array $rule): void
$instance->where('v'.strval($key), $value);
}

foreach ($instance->get() as $model) {
if ($model->delete()) {
++$count;
}
}
$instance->delete();
}

/**
Expand Down Expand Up @@ -210,11 +206,7 @@ public function removeFilteredPolicy(string $sec, string $ptype, int $fieldIndex
}
}

foreach ($instance->get() as $model) {
if ($model->delete()) {
++$count;
}
}
$instance->delete();
}

/**
Expand Down

0 comments on commit 3354b55

Please sign in to comment.