diff --git a/README.md b/README.md index 39a30c5..7619367 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Quickly debugging the amount of database queries per request in Laravel. ### Install via composer +#### For Laravel <= 5.3, please use the [1.1 branch](https://github.com/squareboat/sql-doctor/tree/v1.1)! + ``` $ composer require squareboat/sql-doctor ``` diff --git a/composer.json b/composer.json index dab9fb5..fe528a8 100644 --- a/composer.json +++ b/composer.json @@ -12,12 +12,12 @@ ], "require": { "php": ">=5.4.0", - "illuminate/support": "5.1.*|5.2.*|5.3.*", - "illuminate/config": "5.1.*|5.2.*|5.3.*", - "illuminate/http": "5.1.*|5.2.*|5.3.*", - "illuminate/events": "5.1.*|5.2.*|5.3.*", - "illuminate/database": "5.1.*|5.2.*|5.3.*", - "symfony/debug": "2.8.*|3.0.*|3.1.*" + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*", + "illuminate/config": "5.1.*|5.2.*|5.3.*|5.4.*", + "illuminate/http": "5.1.*|5.2.*|5.3.*|5.4.*", + "illuminate/events": "5.1.*|5.2.*|5.3.*|5.4.*", + "illuminate/database": "5.1.*|5.2.*|5.3.*|5.4.*", + "symfony/debug": "2.8.*|3.0.*|3.1.*|~3.2" }, "autoload": { "psr-4": { diff --git a/src/SqlDoctor.php b/src/SqlDoctor.php index 5d9df13..f4293fa 100644 --- a/src/SqlDoctor.php +++ b/src/SqlDoctor.php @@ -4,6 +4,7 @@ use Illuminate\Database\DatabaseManager; use Illuminate\Events\Dispatcher as Event; +use Illuminate\Foundation\Http\Events\RequestHandled; class SqlDoctor { @@ -18,10 +19,10 @@ public function handle(DatabaseManager $db, Event $event) { $db->connection()->enableQueryLog(); - $event->listen('kernel.handled', function ($request, $response) use($db) { + $event->listen(RequestHandled::class, function ($handled) use($db) { $queries = $db->getQueryLog(); - if ($request->query('sql-doctor') == 2) { + if ($handled->request->query('sql-doctor') == 2) { foreach ($queries as $key => $query) { $queries[$key]['query'] = $this->bindValues($query['query'], $query['bindings']); }