how to enable query log in laravel?

Report
Question
795 views

Our first step should be DB::connection()->enableQueryLog(); After our query, it should be placed $querieslog = DB::getQueryLog(); After that, it should be placed dd($querieslog)

Please explain why do you think this question should be reported?

Report Cancel

DB::connection()->enableQueryLog();

$result = User:where(['status' => 1])->get();

$log = DB::getQueryLog();

dd($log);

Thread Reply

Leave an comment

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>