37 lines
841 B
PHP
37 lines
841 B
PHP
<?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();
|
|
}
|
|
}
|