Im trying to figure out how to get the raw sql query being executed including the binded data in it. Here is what ive got:
\\DB::connection()->enableQueryLog(
Add this function to your application and simply call.
function getQuery($sql){
$query = str_replace(array('?'), array('\'%s\''), $sql->toSql());
$query = vsprintf($query, $sql->getBindings());
return $query;
}
$foo = Foo::where('bar', 'baz');
print_r(getQuery($foo));
Output: select * from Foo
where bar
= 'baz'