2121use Casbin \WebmanPermission \Model \LaravelRuleModel ;
2222use Illuminate \Database \Eloquent \Builder ;
2323use Illuminate \Database \Eloquent \Collection ;
24- use Illuminate \ Support \ Facades \ DB ;
24+ use support \ Db ;
2525use Throwable ;
2626
2727/**
@@ -208,7 +208,7 @@ public function _removeFilteredPolicy(string $sec, string $ptype, int $fieldInde
208208 */
209209 public function removePolicies (string $ sec , string $ ptype , array $ rules ): void
210210 {
211- DB ::transaction (function () use ($ sec , $ ptype , $ rules ) {
211+ Db ::transaction (function () use ($ sec , $ ptype , $ rules ) {
212212 foreach ($ rules as $ rule ) {
213213 $ this ->removePolicy ($ sec , $ ptype , $ rule );
214214 }
@@ -269,7 +269,7 @@ public function updatePolicy(string $sec, string $ptype, array $oldRule, array $
269269 */
270270 public function updatePolicies (string $ sec , string $ ptype , array $ oldRules , array $ newRules ): void
271271 {
272- DB ::transaction (function () use ($ sec , $ ptype , $ oldRules , $ newRules ) {
272+ Db ::transaction (function () use ($ sec , $ ptype , $ oldRules , $ newRules ) {
273273 foreach ($ oldRules as $ i => $ oldRule ) {
274274 $ this ->updatePolicy ($ sec , $ ptype , $ oldRule , $ newRules [$ i ]);
275275 }
@@ -289,7 +289,7 @@ public function updatePolicies(string $sec, string $ptype, array $oldRules, arra
289289 public function updateFilteredPolicies (string $ sec , string $ ptype , array $ newPolicies , int $ fieldIndex , string ...$ fieldValues ): array
290290 {
291291 $ oldRules = [];
292- DB ::transaction (function () use ($ sec , $ ptype , $ fieldIndex , $ fieldValues , $ newPolicies , &$ oldRules ) {
292+ Db ::transaction (function () use ($ sec , $ ptype , $ fieldIndex , $ fieldValues , $ newPolicies , &$ oldRules ) {
293293 $ oldRules = $ this ->_removeFilteredPolicy ($ sec , $ ptype , $ fieldIndex , ...$ fieldValues );
294294 $ this ->addPolicies ($ sec , $ ptype , $ newPolicies );
295295 });
0 commit comments