Answer the question
In order to leave comments, you need to log in
How to pass request to middleware?
There are two middlewares
here, I want to convert some data and pass it to the next middleware, how do I send $content so that the request reaches the middleware trail?
class ConverterMiddleware
{
public function handle($request, Closure $next)
{
$content = json_decode($request->getContent(), true);
$content = $this->convertDate($content);
return $next($content);
}
}
Answer the question
In order to leave comments, you need to log in
Pass Request $request
AND in middleware either change existing parameters or add new ones like this:$request->request->add(['variable' => 'value']);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question