Add data to Request object within a Middleware

Posted 1 year ago by viktorivanov

Hello, I have a custom middleware where I'm handling the current request and if a specific request header is present I need to pass down data to the chain.

And then in my controller i will check based on the data I've added to the request what response to return to the user.

So my question is:

  • Isrequest()->merge($myCustomData) the proper way to pass my data (the data will be a decoded json string).

Thank you

Please sign in or create an account to participate in this conversation.