Skip to content

Instantly share code, notes, and snippets.

@trizz
Created February 25, 2014 15:24
Show Gist options
  • Save trizz/9210998 to your computer and use it in GitHub Desktop.
Save trizz/9210998 to your computer and use it in GitHub Desktop.
Get a list of executed Laravel Illuminate queries
<?php
# Log de querys
foreach(DB::getQueryLog() AS $queryData) {
$query = $queryData['query'];
$pdo = DB::getPdo();
foreach($queryData['bindings'] as $binding) {
if(is_string($binding)) {
$query = preg_replace('/\?/', $pdo->quote($binding), $query, 1);
} else {
$query = $query."\n\nBinding: ".print_r($binding,1);
}
}
echo $query, $queryData['time'].'<br>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment