From c743240d63c2a4e53cac45b78e19553446752934 Mon Sep 17 00:00:00 2001 From: lisida <506400117@qq.com> Date: Mon, 25 Mar 2019 10:15:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9sql=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Listeners/QueryListener.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Listeners/QueryListener.php b/src/Listeners/QueryListener.php index 64ce7c4..2e051e1 100644 --- a/src/Listeners/QueryListener.php +++ b/src/Listeners/QueryListener.php @@ -35,7 +35,8 @@ class QueryListener { if (env('APP_DEBUG')) { $sql = str_replace("?", "'%s'", $event->sql); - $this->logger->debug(vsprintf($sql, $event->bindings), ['conn' => $event->connectionName, 'time' => $event->time.'ms']); + $log = $event->bindings ? vsprintf($sql, $event->bindings) : $sql; + $this->logger->debug($log, ['conn' => $event->connectionName, 'time' => $event->time.'ms']); } }