This commit is contained in:
36
api/bootstrap/helpers_functions.php
Normal file
36
api/bootstrap/helpers_functions.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('dd')) {
|
||||
|
||||
function dd(...$vars)
|
||||
{
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: *');
|
||||
header('Access-Control-Allow-Headers: *');
|
||||
http_response_code(500);
|
||||
|
||||
foreach ($vars as $v) {
|
||||
\Symfony\Component\VarDumper\VarDumper::dump($v);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('getSql')) {
|
||||
|
||||
function getSql($query, $withBindings = true)
|
||||
{
|
||||
if ($withBindings) {
|
||||
|
||||
return vsprintf(
|
||||
str_replace('?', '%s', $query->toSql()),
|
||||
collect($query->getBindings())->map(function ($binding) {
|
||||
return is_numeric($binding) ? $binding : "'{$binding}'";
|
||||
})->toArray()
|
||||
);
|
||||
}
|
||||
|
||||
return $query->toSql();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user