Skip to content

Instantly share code, notes, and snippets.

@faulker
Created May 28, 2015 22:43
Show Gist options
  • Save faulker/c1401110ae0c1456c072 to your computer and use it in GitHub Desktop.
Save faulker/c1401110ae0c1456c072 to your computer and use it in GitHub Desktop.
Laravel DB Debug
function listenForSqlAndDisplay()
{
\DB::listen(function($sql, $bindings)
{
foreach ($bindings as $val) {
$sql = preg_replace('/\?/', "'{$val}'", $sql, 1);
}
var_dump($sql);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment