diff --git a/README.md b/README.md index 96c44f5..0a7f90e 100644 --- a/README.md +++ b/README.md @@ -140,8 +140,6 @@ php artisan larke-admin:import-route - laravel/framework - - [lake/larke-jwt](https://github.com/deatil/larke-jwt) (代码修改自 lcobucci/jwt) - - casbin/casbin - composer/semver diff --git a/src/larke/admin/Admin.php b/src/larke/admin/Admin.php index 38b2297..18cef96 100644 --- a/src/larke/admin/Admin.php +++ b/src/larke/admin/Admin.php @@ -18,12 +18,12 @@ class Admin /** * 版本号 */ - const VERSION = "2.0.8"; + const VERSION = "2.0.9"; /** * 发布号 */ - const RELEASE = "20240731"; + const RELEASE = "20240806"; /** * 扩展 diff --git a/src/larke/admin/Events/Action.php b/src/larke/admin/Events/Action.php index e3e815d..91ecd59 100644 --- a/src/larke/admin/Events/Action.php +++ b/src/larke/admin/Events/Action.php @@ -36,7 +36,7 @@ public function trigger($event, ...$var): void $listeners = $this->arraySort($listeners, 'sort'); - foreach ($listeners as $key => $listener) { + foreach ($this->range($listeners) as $listener) { $this->dispatch($listener['listener'], $var); } } diff --git a/src/larke/admin/Events/Event.php b/src/larke/admin/Events/Event.php index 4d51e22..2c52080 100644 --- a/src/larke/admin/Events/Event.php +++ b/src/larke/admin/Events/Event.php @@ -4,6 +4,7 @@ namespace Larke\Admin\Events; +use Iterator; use ReflectionClass; use ReflectionMethod; @@ -253,6 +254,19 @@ protected function dispatch($event, array $params = []) return $this->pool->call($call, $params); } + /** + * 迭代数据 + * + * @param array $data 数据 + * @return Iterator + */ + protected function range(array $data = []): Iterator + { + foreach ($data as $k => $v) { + yield $k => $v; + } + } + /** * 排序 */ diff --git a/src/larke/admin/Events/Filter.php b/src/larke/admin/Events/Filter.php index ebe5ff4..d70418c 100644 --- a/src/larke/admin/Events/Filter.php +++ b/src/larke/admin/Events/Filter.php @@ -40,7 +40,7 @@ public function trigger($event, $params = null, ...$var) $tmp = $var; $result = $params; - foreach ($listeners as $key => $listener) { + foreach ($this->range($listeners) as $listener) { array_unshift($tmp, $result); $result = $this->dispatch($listener['listener'], $tmp);