Skip to content

Instantly share code, notes, and snippets.

@sworup
Created December 27, 2016 07:38
Show Gist options
  • Save sworup/70c392c8affe090bbf80995a5a6c087d to your computer and use it in GitHub Desktop.
Save sworup/70c392c8affe090bbf80995a5a6c087d to your computer and use it in GitHub Desktop.
Adding a DB Listener to log the sql query in log file
<?php
use Illuminate\Support\Facades\Log;
\DB::listen(function($sql, $bindings, $time) {
Log::info($sql);
Log::info($bindings);
Log::info($time);
});
// Your query goes after this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment