Our first step should be

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

After our query it should be placed

$querieslog = DB::getQueryLog();

After that it shou;ld be placed

dd($querieslog)

A lot of recent Laravel interview questions were based on this information.

Example

                                        

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

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

$log = DB::getQueryLog();

dd($log);

Suggest An Answer

No suggestions avaliable!