Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Pineco.de:
Using Request and Response Macros
Oct 05, 2018 @ 16:18:09

On the Pineco.de blog they've posted a tutorial for those out there using Laravel's request and response handling to add in macros to modify the information in the request/response based on custom logic.

We’ve already talked about the power of the collection macros. Now let’s take a look at the request and response macros as well to explore the possibilities that extending their functionality offers.

The tutorial starts by showing the creation of a filter request macro. This macro pulls the information out of the response and removes data that contains null values. Similarly, they show how to create a toSpecialFormat macro on the response, formatting the response as a JSON message rather than normal output.

tagged: tutorial laravel request response macro

Link: https://pineco.de/using-request-and-response-macros/


Trending Topics: