Level 56
Use an after middleware.
After middleware allows to manipulate request after it has been processed and returned by the controller action.
In my controllers I'm returning arrays of data.
public function index()
{
return $this->repo->paginate(25);
}
I want to add content to the above response, ie. if I had a debug parameter present, it should add a _debug array to the response through some kind of array_merge thing.
Is it possible to add anything to the response through middleware or something else, when you're returning data from the controller?
Use an after middleware.
After middleware allows to manipulate request after it has been processed and returned by the controller action.
Please or to participate in this conversation.