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 | |
// edit app/config/local/database.php -> 'log' => true | |
// @ http://stackoverflow.com/questions/19131731/laravel-4-logging-sql-queries | |
if (Config::get('database.log', false)) { | |
Event::listen('illuminate.query', function($query, $bindings, $time, $name) { | |
$data = compact('bindings', 'time', 'name'); | |
// Format binding data for sql insertion | |
foreach ($bindings as $i => $binding) { |