Skip to content

Commit

Permalink
middleware setup
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Jan 10, 2025
1 parent 10a54c9 commit bf669a0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,11 @@ function routed(
foreach ($middlewares as $middlewareName) {
$className = (string) $middlewareName;
$middlewareDependencies = $router->dependencies()->extract($className, $container);
$queue[$className] = new $className(...$middlewareDependencies);
$middleware = new $className(...$middlewareDependencies);
if (method_exists($middleware, 'setUp')) {
$middleware->setUp(...$middlewareName->arguments());
}
$queue[$className] = $middleware;
}
$queue[] = new RelayHandle($responseFactory);
$relay = new Relay($queue);
Expand Down

0 comments on commit bf669a0

Please sign in to comment.