->getPayload()
If the request data is
$_POSTdata or a JSON string, you can use thegetPayload()method which returns an instance ofInputBagwrapping this data:
$data = $request->getPayload();
// Example 1:
// the request has some POST data
// (e.g. `foo: bar` sent as `application/x-www-form-urlencoded`)
$request->getPayload()->all();
// returns the PHP array: ['foo' => 'bar']
// Example 2:
// the request has body contents as some JSON-encoded data
// (e.g. `{"foo": "bar"}`)
$request->getPayload()->all();
// returns the JSON-decoded data as a PHP array: ['foo' => 'bar']