middleware? perhaps.. need to know a bit more on what you are trying to do
I would like to format my response with a transformer (like fractal), so, instead of putting the logic in each controller action, I thought of create a response listener to "catch" each response and handle it before return it.
I have tried to register this service provider:
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
class ResponseListenerServiceProvider extends ServiceProvider
{
public function register()
{
Event::listen(
'laravel.done', function() {
die('Goodbye');
});
}
}
as I read that "laravel.done" is the right event but doesn't seem to be working
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community