Skip to content

Instantly share code, notes, and snippets.

@jkirira
Created March 16, 2026 10:32
Show Gist options
  • Select an option

  • Save jkirira/48cd657c30d0410d30cf0d82982bb9df to your computer and use it in GitHub Desktop.

Select an option

Save jkirira/48cd657c30d0410d30cf0d82982bb9df to your computer and use it in GitHub Desktop.
QueryLog
<?php
\DB::enableQueryLog();
$res = $this->sortFilterPaginate($transaction, function ($model) {
return (new TransactionUiTransformer())->transformOut($model);
}, [], $filterFunction);
$log = \DB::getQueryLog()[0];
$formatted = $log['query'];
foreach ($log['bindings'] as $binding) {
$pos = strpos($formatted, '?');
if ($pos !== false) {
$formatted = substr_replace($formatted, "'" . $binding ."'", $pos, 1);
}
}
dd($formatted, $log, $log['bindings']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment