| Conditions | 4 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function runQueryDebugger($log = true, $terminal = false) |
||
| 26 | { |
||
| 27 | if (Config::get('database.query_debugging')) { |
||
| 28 | DB::listen(function ($event) use ($terminal, $log) { |
||
| 29 | $fullQuery = vsprintf(str_replace(['%', '?'], ['%%', '%s'], $event->sql), $event->bindings); |
||
| 30 | |||
| 31 | $text = $event->connectionName . ' (' . $event->time . '): ' . $fullQuery; |
||
| 32 | |||
| 33 | if ($terminal) { |
||
| 34 | dump($text); |
||
| 35 | } |
||
| 36 | |||
| 37 | if ($log) { |
||
| 38 | Log::info($text); |
||
| 39 | } |
||
| 40 | }); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 45 |