ZhouMengkang
ZhouMengkang

Reputation: 193

how to print SQL statement in Laravel 5

As you know, we can use the method DB::getQueryLog() to print the sql statement in Laravel 4.

But it doesn't work in Laravel 5.

Upvotes: 0

Views: 1503

Answers (2)

Alupotha
Alupotha

Reputation: 10103

if you want to see the currently running SQL query you can use this

https://github.com/itsgoingd/clockwork

installation instructions are clearly mentioned in the README file

enter image description here

Upvotes: 1

nozzleman
nozzleman

Reputation: 9649

Query log is disabled by default in L5. Call

DB::connection()->enableQueryLog();
$queries = DB::getQueryLog();

before trying to log it. See the docs for more info .

Upvotes: 1

Related Questions