1414use Casbin \Persist \AdapterHelper ;
1515use DateTime ;
1616use Casbin \Exceptions \InvalidFilterTypeException ;
17- use Illuminate \Support \Facades \DB ;
1817
1918/**
2019 * DatabaseAdapter.
@@ -28,14 +27,14 @@ class DatabaseAdapter implements DatabaseAdapterContract, BatchDatabaseAdapterCo
2827 /**
2928 * @var bool
3029 */
31- private $ filtered = false ;
30+ private bool $ filtered = false ;
3231
3332 /**
3433 * Rules eloquent model.
3534 *
3635 * @var Rule
3736 */
38- protected $ eloquent ;
37+ protected Rule $ eloquent ;
3938
4039 /**
4140 * the DatabaseAdapter constructor.
@@ -331,10 +330,8 @@ public function loadFilteredPolicy(Model $model, $filter): void
331330 }
332331 $ rows = $ instance ->get ()->makeHidden (['created_at ' ,'updated_at ' , 'id ' ])->toArray ();
333332 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 )));
338335 $ this ->loadPolicyLine (trim ($ line ), $ model );
339336 }
340337 $ this ->setFiltered (true );
0 commit comments