laravel print builder code example
Example: laravel print builder
// 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";