If you want to log all SQL queries to the laravel.log
file use the following code in your AppServiceProvider.php
– boot()
method:
class AppServiceProvider extends ServiceProvider
{
// ...
public function boot()
{
if (App::isLocal()) {
DB::listen(function ($query) {
logger(Str::replaceArray('?', $query->bindings, query->sql));
});
}
}
}