diff --git a/src/AnnotationController.php b/src/AnnotationController.php index 8d24b5a..ad49cb7 100644 --- a/src/AnnotationController.php +++ b/src/AnnotationController.php @@ -89,6 +89,9 @@ public function __hook(?array $actionArg = [],?array $onRequestArg = null) if($ret === false){ return; } + if(!empty($call->injectParamName)){ + $onRequestArg[$call->injectParamName] = $ret; + } } } }catch (\Throwable $exception){ diff --git a/src/Attributes/PreCall.php b/src/Attributes/PreCall.php index 8f0e7c9..0013a04 100644 --- a/src/Attributes/PreCall.php +++ b/src/Attributes/PreCall.php @@ -8,8 +8,10 @@ class PreCall { public $call; - function __construct(callable $call) + public ?string $injectParamName = null; + function __construct(callable $call,string $injectParamName = null) { $this->call = $call; + $this->injectParamName = $injectParamName; } } \ No newline at end of file