How Do I Get the Query Builder to Output Its Raw SQL Query as a String? Technology Community › Category: Laravel › How Do I Get the Query Builder to Output Its Raw SQL Query as a String? 0 Vote Up Vote Down VietMX Staff asked 4 years ago Problem Given the following code: DB::table('users')->get(); I want to get the raw SQL query string that the database query builder above will generate. How do I do this? To output to the screen the last queries ran you can use: DB::enableQueryLog(); dd(DB::getQueryLog());