14
14
use Casbin \Persist \AdapterHelper ;
15
15
use DateTime ;
16
16
use Casbin \Exceptions \InvalidFilterTypeException ;
17
- use Illuminate \Support \Facades \DB ;
18
17
19
18
/**
20
19
* DatabaseAdapter.
@@ -28,14 +27,14 @@ class DatabaseAdapter implements DatabaseAdapterContract, BatchDatabaseAdapterCo
28
27
/**
29
28
* @var bool
30
29
*/
31
- private $ filtered = false ;
30
+ private bool $ filtered = false ;
32
31
33
32
/**
34
33
* Rules eloquent model.
35
34
*
36
35
* @var Rule
37
36
*/
38
- protected $ eloquent ;
37
+ protected Rule $ eloquent ;
39
38
40
39
/**
41
40
* the DatabaseAdapter constructor.
@@ -331,10 +330,8 @@ public function loadFilteredPolicy(Model $model, $filter): void
331
330
}
332
331
$ rows = $ instance ->get ()->makeHidden (['created_at ' ,'updated_at ' , 'id ' ])->toArray ();
333
332
foreach ($ rows as $ row ) {
334
- $ row = array_filter ($ row , function ($ value ) { return !is_null ($ value ) && $ value !== '' ; });
335
- $ line = implode (', ' , array_filter ($ row , function ($ val ) {
336
- return '' != $ val && !is_null ($ val );
337
- }));
333
+ $ row = array_filter ($ row , static fn ($ value ): bool => !is_null ($ value ) && $ value !== '' );
334
+ $ line = implode (', ' , array_filter ($ row , static fn ($ val ): bool => '' != $ val && !is_null ($ val )));
338
335
$ this ->loadPolicyLine (trim ($ line ), $ model );
339
336
}
340
337
$ this ->setFiltered (true );
0 commit comments