Laravel: Response Macro
It’s quite straightforward to extend a class functionality with Macro. This time I show how to extend the Response class in Laravel.
Create a class in app/Macros/Http
called Response.php
and add the content as following:
Then register the Macro in AppServiceProvider
Now you may test your new responses: