This commit is contained in:
William 2023-01-27 12:37:56 +00:00
parent b643c9834d
commit ecd318498f

View File

@ -60,12 +60,14 @@ abstract class Route {
$middlewares = [$middlewares]; $middlewares = [$middlewares];
} }
foreach ($middlewares as $middleware) { foreach ($middlewares as $middleware) {
self::$groups[(count(self::$groups) - 1)][] = $middleware; array_push(
self::$groups[array_key_last(self::$groups)], $middleware
);
} }
} }
static function group(callable $callback) { static function group(callable $callback) {
self::$groups[] = []; array_push(self::$groups, []);
$callback(); $callback();
array_pop(self::$groups); array_pop(self::$groups);
} }