To Log all queries executed by Eloquent:
Add the below code snippet into AppServiceProvider boot() method.
Add the below code snippet into AppServiceProvider boot() method.
\Event::listen('Illuminate\Database\Events\QueryExecuted', function ($query) { \Illuminate\Support\Facades\Log::info($query->sql); \Illuminate\Support\Facades\Log::info($query->bindings); \Illuminate\Support\Facades\Log::info($query->time); });
\DB::listen(function($sql, $bindings, $time) { Log::info($sql); Log::info($bindings); Log::info($time); });
No comments:
Post a Comment