Skip to content

Commit 88aef02

Browse files
authored
Remove Laravel <5.2 code (#1461)
1 parent 27b088a commit 88aef02

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

src/LaravelDebugbar.php

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -340,30 +340,15 @@ function ($level, $message = null, $context = null) use ($logger) {
340340

341341
try {
342342
$db->listen(
343-
function (
344-
$query,
345-
$bindings = null,
346-
$time = null,
347-
$connectionName = null
348-
) use (
349-
$db,
350-
$queryCollector
351-
) {
343+
function (\Illuminate\Database\Events\QueryExecuted $query) use ($db, $queryCollector) {
352344
if (!app(static::class)->shouldCollect('db', true)) {
353345
return; // Issue 776 : We've turned off collecting after the listener was attached
354346
}
355-
// Laravel 5.2 changed the way some core events worked. We must account for
356-
// the first argument being an "event object", where arguments are passed
357-
// via object properties, instead of individual arguments.
358-
if ($query instanceof \Illuminate\Database\Events\QueryExecuted) {
359-
$bindings = $query->bindings;
360-
$time = $query->time;
361-
$connection = $query->connection;
362-
363-
$query = $query->sql;
364-
} else {
365-
$connection = $db->connection($connectionName);
366-
}
347+
348+
$bindings = $query->bindings;
349+
$time = $query->time;
350+
$connection = $query->connection;
351+
$query = $query->sql;
367352

368353
//allow collecting only queries slower than a specified amount of milliseconds
369354
$threshold = app('config')->get('debugbar.options.db.slow_threshold', false);

0 commit comments

Comments
 (0)