Builder de impresión de Laravel

// query builder
$query = DB::table('table_name')->where('id', 1);
// binding replaced
$rawQuery = str_replace_array('?', $query->getBindings(), $query->toSql());
// for laravel 5.8^
$rawQuery = Str::replaceArray('?', $query->getBindings(), $query->toSql());
 
dd($rawSql); // "select * from `table_name` where `id` = 1";
Yingfufu