Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Event::listen('illuminate.query', function($query, $bindings, $time, $name)
$data = compact('bindings', 'time', 'name');
foreach ($bindings as $i => $binding)
if($binding instanceof \DateTime)
$bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
$bindings[$i] = "'$binding'";
$query = str_replace(array('%', '?'), array('%%', '%s'), $query);
$query = vsprintf($query, $bindings);
LogSql::info($query, $data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.