There is a task to globally control what the application will return (laravel5 / lumen). Using the controller as an example, it could be something like this:

echo '...'; return '...'; return view(); return response('...'); ... 

It is necessary in some global x-place to put something like:

 if (!$response instedOf Response) { ... } 

To be able to return only one Response object (custom wrapper over the box).

Previously, there were global posts in laravel that you could subscribe to, but I did not find anything similar for version 5.

  • Ok, what's stopping you from creating a method in the base controller class that will control the output? - Orange_shadow
  • @Orange_shadow, efficiency to strive to 0. So, as there is no control, so nothing prevents me from calling something else, and not my own method. When there is a team - this is not very good. - Nepster
  • It is strange then that the documentation generally propose to create your answer: Response Macros - Orange_shadow
  • And also, I'm not sure, but in middleware, there is a handler after the application runs. - Orange_shadow

0