Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

print query in laravel

// query builder
$query = DB::table('table_name')->where('id', 1);

// binding replaced
$sql = str_replace_array('?', $query->getBindings(), $query->toSql());

// for laravel 5.8^
$sql = Str::replaceArray('?', $query->getBindings(), $query->toSql());

// print
dd($sql);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #print #query #laravel
ADD COMMENT
Topic
Name
7+7 =