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
Response.php and add the content as following:
Then register the Macro in
Now you may test your new responses: