Last active
November 16, 2015 16:19
-
-
Save cleaver/6ba2092950ee7ba95dc1 to your computer and use it in GitHub Desktop.
Laravel: debug SQL statements
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 | |
use Illuminate\Support\Facades\Event; | |
use Illuminate\Support\Facades\Log; | |
Event::listen("illuminate.query", function($query, $bindings, $time, $name){ | |
$this->output($query); | |
$this->output(json_encode($bindings)); | |
// Or, send to log: | |
Log::sql($query."\n"); | |
Log::sql(json_encode($bindings)."\n"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment