Laravel Show Debug Query SQL
// Debug SQL query
// app/Providers/AppServiceProvider.php
public function boot()
{
//...
$this->debugQueries();
}
protected function debugQueries()
{
if (env('APP_DEBUG_QUERIES')) {
DB::listen(function ($query) {
error_log(
"Query [$query->time ms]: $query->sql\n"
. "Params: " . print_r($query->bindings, true)
);
});
}
}
Tiago F2