21
21
use Casbin \WebmanPermission \Model \LaravelRuleModel ;
22
22
use Illuminate \Database \Eloquent \Builder ;
23
23
use Illuminate \Database \Eloquent \Collection ;
24
- use Illuminate \ Support \ Facades \ DB ;
24
+ use support \ Db ;
25
25
use Throwable ;
26
26
27
27
/**
@@ -208,7 +208,7 @@ public function _removeFilteredPolicy(string $sec, string $ptype, int $fieldInde
208
208
*/
209
209
public function removePolicies (string $ sec , string $ ptype , array $ rules ): void
210
210
{
211
- DB ::transaction (function () use ($ sec , $ ptype , $ rules ) {
211
+ Db ::transaction (function () use ($ sec , $ ptype , $ rules ) {
212
212
foreach ($ rules as $ rule ) {
213
213
$ this ->removePolicy ($ sec , $ ptype , $ rule );
214
214
}
@@ -269,7 +269,7 @@ public function updatePolicy(string $sec, string $ptype, array $oldRule, array $
269
269
*/
270
270
public function updatePolicies (string $ sec , string $ ptype , array $ oldRules , array $ newRules ): void
271
271
{
272
- DB ::transaction (function () use ($ sec , $ ptype , $ oldRules , $ newRules ) {
272
+ Db ::transaction (function () use ($ sec , $ ptype , $ oldRules , $ newRules ) {
273
273
foreach ($ oldRules as $ i => $ oldRule ) {
274
274
$ this ->updatePolicy ($ sec , $ ptype , $ oldRule , $ newRules [$ i ]);
275
275
}
@@ -289,7 +289,7 @@ public function updatePolicies(string $sec, string $ptype, array $oldRules, arra
289
289
public function updateFilteredPolicies (string $ sec , string $ ptype , array $ newPolicies , int $ fieldIndex , string ...$ fieldValues ): array
290
290
{
291
291
$ oldRules = [];
292
- DB ::transaction (function () use ($ sec , $ ptype , $ fieldIndex , $ fieldValues , $ newPolicies , &$ oldRules ) {
292
+ Db ::transaction (function () use ($ sec , $ ptype , $ fieldIndex , $ fieldValues , $ newPolicies , &$ oldRules ) {
293
293
$ oldRules = $ this ->_removeFilteredPolicy ($ sec , $ ptype , $ fieldIndex , ...$ fieldValues );
294
294
$ this ->addPolicies ($ sec , $ ptype , $ newPolicies );
295
295
});
0 commit comments