Created
September 27, 2020 20:52
-
-
Save yoelpc4/74ec559ed4209198ff7cb27e7e74ffca to your computer and use it in GitHub Desktop.
Laravel SQL Debug
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
\DB::listen(function (\Illuminate\Database\Events\QueryExecuted $query) { | |
$sql = $query->sql; | |
$bindings = implode(', ', $query->bindings); | |
$time = $query->time; | |
\Log::info("\nSQL: {$sql}\nBindings: {$bindings}\nTime: {$time}\n\n"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put the snippet above on your
AppServiceProvider
file atboot
method