Skip to content

Instantly share code, notes, and snippets.

@amberlex78
Created August 9, 2020 07:36
Show Gist options
  • Save amberlex78/8f5efeb9df39edd0e147de099bdac16e to your computer and use it in GitHub Desktop.
Save amberlex78/8f5efeb9df39edd0e147de099bdac16e to your computer and use it in GitHub Desktop.
Display or log query

Display or log query

Display query

Add code in a file:

\DB::enableQueryLog();

$user = App\User::get();

dd(\DB::getQueryLog());

Log all SQL executed in Eloquent

Add to routes:

Event::listen('illuminate.query', function($query)
{
    \Log::info($query);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment