Modifying Laravel's Request Object

Symfony had changed how requests can be modified in incoming middleware.

The recommended way to achieve this in Laravel has been:

            $request->request->add(["scope" => data_get(

or for JSON:

            $request->json()->add(["scope" => data_get(

That is no longer sufficient as of symfony/psr-http-message-bridge version 2.3, and you must now regenerate the request object and update the content (see the last parameter).


I suspect this is a bug in the Symfony package, but for now this is the recommended solution.