Created
August 20, 2018 15:51
-
-
Save rrdial/77258caf08161156452bd6ac2744378d to your computer and use it in GitHub Desktop.
Laravel Database Query Debugging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
\DB::listen(function($query) { | |
static $i = 0; | |
$sql = str_replace('?', '"%s"', $query->sql); | |
\Log::debug(sprintf('********** Query number %d ********** ', ++$i) . vsprintf($sql, $query->bindings)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment