Thanh

Laravel print out sql

March 01, 2017 | 0 Minute Read

In some cases, cannot use debugbar package to profiler SQL. Put it into routes.php. More specific in Laravel 5.4 (/routes/api.php)

\Event::listen('Illuminate\Database\Events\QueryExecuted', function ($query) {
    \Illuminate\Support\Facades\Log::info($query->sql);
});