Answer the question
In order to leave comments, you need to log in
How to pass data from mediator to controller?
I thought that I could exclude additional checks from the controller by doing it all in midddleware. That is, it is necessary to transfer a variable from the intermediary to the controller, depending on the value of which certain actions will be performed. Question: how can I pass a variable from an intermediary to a controller?
Answer the question
In order to leave comments, you need to log in
In controller constructor
$this->middleware(function ($request, $next) {
// $this->variable = 10;
return $next($request);
});
Add value to container and then push it through DI or service location?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question