Skip to content

Commit 920f543

Browse files
author
Mads Møller
committed
expressions
1 parent 712aed8 commit 920f543

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Collectors/DatabaseQueryCollector.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Illuminate\Database\Connection;
88
use Illuminate\Database\Events\QueryExecuted;
9+
use Illuminate\Database\Query\Expression;
910
use Napp\Xray\Segments\SqlSegment;
1011

1112
class DatabaseQueryCollector extends EventsCollector
@@ -15,7 +16,8 @@ class DatabaseQueryCollector extends EventsCollector
1516
public function registerEventListeners(): void
1617
{
1718
$this->app->events->listen(QueryExecuted::class, function (QueryExecuted $query) {
18-
$this->handleQueryReport($query->sql, $query->bindings, $query->time, $query->connection);
19+
$sql = $query->sql instanceof Expression ? $query->sql->getValue() : $query->sql;
20+
$this->handleQueryReport($sql, $query->bindings, $query->time, $query->connection);
1921
});
2022

2123
$this->bindingsEnabled = config('xray.db_bindings');

0 commit comments

Comments
 (0)