Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

matttonks11's avatar

Append additional data to Request

When making a post request to store some data, I'm using a Request object to validate the data first before it hits the store method on my controller.

I was wondering is there a simple way to add an extra piece of data to the request object so it's available when the validated data hits the controller?

0 likes
2 replies
Nakash's avatar
Nakash
Best Answer
Level 2

Hi matttonks11,

The easiest way I know of for that is to write :

$request->merge(['key' => value]);

I hope it help !

1 like

Please or to participate in this conversation.