Cara mencatat kueri di Laravel
DB::enableQueryLog();
$arr_user = DB::table('users')->select('name', 'email as user_email')->get();
dd(DB::getQueryLog());
Indian Gooner
DB::enableQueryLog();
$arr_user = DB::table('users')->select('name', 'email as user_email')->get();
dd(DB::getQueryLog());
DB::connection()->enableQueryLog(); //enable query log
$data = $order->all(); //query execute
$queries = DB::getQueryLog(); //get query
return dd($queries); //show query
public function show(Order $order){
\DB::connection()->enableQueryLog();
$data = $order->all();
$queries = \DB::getQueryLog();
return dd($queries);
}