Skip to content

Instantly share code, notes, and snippets.

@KeithNdhlovu
Last active August 11, 2016 11:13
Show Gist options
  • Save KeithNdhlovu/e54e697779df7c5859b7a11529e2867d to your computer and use it in GitHub Desktop.
Save KeithNdhlovu/e54e697779df7c5859b7a11529e2867d to your computer and use it in GitHub Desktop.
Laravel 5 show query log
<?php
DB::enableQueryLog();
DB::listen(
function ($sql, $bindings, $time) {
// $sql - select * from `ncv_users` where `ncv_users`.`id` = ? limit 1
// $bindings - [5]
// $time(in milliseconds) - 0.38
dd($sql);
}
);
//Laravel 5.2
DB::connection('connection_name')->enableQueryLog();
DB::connection('connection_name')->getQueryLog()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment