Skip to content

Instantly share code, notes, and snippets.

@vjandrea
Created October 4, 2013 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vjandrea/6824658 to your computer and use it in GitHub Desktop.
Save vjandrea/6824658 to your computer and use it in GitHub Desktop.
Laravel 4 query logger. Put this in template's footer. Credits to: http://stackoverflow.com/a/19085511
<script type="text/javascript">
var queries = {{ json_encode(DB::getQueryLog()) }};
console.log('/****************************** Database Queries ******************************/');
console.log(' ');
$.each(queries, function(id, query) {
console.log(' ' + query.time + ' | ' + query.query + ' | ' + query.bindings[0]);
});
console.log(' ');
console.log('/****************************** End Queries ***********************************/');
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment