Ad

Laravel 5.2 - Display All SQLs Executed In Eloquent Not Working

- 1 answer

I used to use the following code in routes.php to display all SQLs executed in Eloquent:

// Display all SQL executed in Eloquent
Event::listen('illuminate.query', function($query)
{
    var_dump($query);
});

But it doesn't work in Laravel 5.2 any more. Is it possible to get this feature back in 5.2? Thanks.

Ad

Answer

I found this replacement:

DB::listen(function ($event) {
    dump($event->sql);
    dump($event->bindings);
});
Ad
source: stackoverflow.com
Ad