Laravel 5.6: Debug/dump SQL queries

raw

phork0.php

1
2
3
4
5
6
7
8
<?php
\DB::connection()->enableQueryLog();
 
// ... your code
 
//output query log
var_dump(\DB::getQueryLog());
?>
raw

phork1.php

1
2
3
4
<?php
\Event::listen('Illuminate\Database\Events\QueryExecuted', function($query) {
    var_dump($query);
});
Christian Weiske Christian Weiske
owner

History