Support the ongoing development of Laravel.io →
posted 9 years ago
Architecture
Last updated 2 years ago.
0

middleware? perhaps.. need to know a bit more on what you are trying to do

0

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.

0

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

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

matiux matiux Joined 28 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.