1DB::enableQueryLog();
2
3# <!-- YOUR QUERY HERE --->
4User::all();
5
6$query = collect(DB::getQueryLog())->map(function($query){
7 return str_replace_array('?', $query['bindings'], $query['query']);
8})->join("\n");
9
10dd($query); // Outputs: select * from `users`