Created
June 5, 2017 10:32
-
-
Save vinaydotblog/5809ca15c7873eab6c2b2b6782473537 to your computer and use it in GitHub Desktop.
Clean query log for laravel
This file contains hidden or 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 ($sql) { | |
$log = vsprintf('[SQL] - ' . str_replace('?', '"%s"', $sql->sql), $sql->bindings); | |
if( App::runningInConsole() ) { | |
print($log); | |
} else { | |
\Log::info($log); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment