Skip to content

Commit

Permalink
Add helper to dump ready to use SQL queries
Browse files Browse the repository at this point in the history
  • Loading branch information
ifox committed Jul 18, 2019
1 parent 15a9331 commit 87e2050
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Helpers/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ function ddd(...$args)
}
}

if (!function_exists('dumpUsableSqlQuery')) {
function dumpUsableSqlQuery($query)
{
dd(vsprintf(str_replace('?', '%s', $query->toSql()), array_map(function ($binding) {
return is_numeric($binding) ? $binding : "'{$binding}'";
}, $query->getBindings())));
}
}

if (!function_exists('classUsesDeep')) {
function classUsesDeep($class, $autoload = true)
{
Expand Down

0 comments on commit 87e2050

Please sign in to comment.