Last active
August 11, 2016 11:13
-
-
Save KeithNdhlovu/e54e697779df7c5859b7a11529e2867d to your computer and use it in GitHub Desktop.
Laravel 5 show query log
This file contains hidden or 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 | |
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