企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
``` app('db')->connection()->enableQueryLog(); //这里就是要查询的SQL语句 $log = app('db')->getQueryLog(); dd($log); //打印sql语句 ``` ``` protected function write(array $record) { $sql = sprintf('INSERT INTO %s (tag, timestamp, level, message) VALUES (?, ?, ?, ?)', Common::prefixTable('logger_message')); $queryLog = Db::isQueryLogEnabled(); Db::enableQueryLog(false); Db::query($sql, array($record['extra']['class'], $record['datetime']->format('Y-m-d H:i:s'), $record['level_name'], trim($record['formatted']))); Db::enableQueryLog($queryLog); } ```