Laravel - Getting Started - Listening For Query Events
If you would like to specify a closure that is invoked for each SQL query executed by your application, you may use the DB
facade's listen
method. This method can be useful for logging queries or debugging. You may register your query listener closure in the boot
method of a service provider:
sql;
// $query->bindings;
// $query->time;
});
}
}