Skip to content

Instantly share code, notes, and snippets.

View azizramdan's full-sized avatar

Aziz Ramdan Kurniawan azizramdan

View GitHub Profile
private function getSql($query)
{
$bindings = $query->getBindings();
return preg_replace_callback('/\?/', function ($match) use (&$bindings, $query) {
return $query->getConnection()->getPdo()->quote(array_shift($bindings));
}, $query->toSql());
}
use Illuminate\Database\Events\QueryExecuted;
@azizramdan
azizramdan / web.php
Last active January 6, 2022 03:06
dump query
\DB::listen(function ($query) {
dump($query->sql, $query->bindings);
});