Answers for "laravel print builder"

PHP
0

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";
Posted by: Guest on February-23-2021

Browse Popular Code Answers by Language