This commit is contained in:
2020-09-04 18:44:01 +08:00
parent 412ebc1afc
commit 1d7cc3fa81
3 changed files with 19 additions and 15 deletions
+10 -7
View File
@@ -49,13 +49,16 @@ class Middleware
*/
public function getGenerate($node)
{
$last = function ($passable) use ($node) {
return Dispatch::create($node->handler, $passable)->dispatch();
};
$middleWares = $this->annotation($node);
$data = array_reduce(array_reverse($middleWares), $this->core(), $last);
$this->middleWares = [];
return $node->callback = $data;
foreach ($node->handler as $key => $value) {
$last = function ($passable) use ($node) {
return Dispatch::create($node->handler, $passable)->dispatch();
};
$middleWares = $this->annotation($node);
$data = array_reduce(array_reverse($middleWares), $this->core(), $last);
$this->middleWares = [];
$node->callback[$key] = $data;
}
return $node;
}