Skip to content

Commit

Permalink
V2.0 (#2)
Browse files Browse the repository at this point in the history
* Bumped version

* Updated listen() closure

* Version 1.1 link added in readme

* Minor fix

* Minor fix
  • Loading branch information
akaamitgupta committed Jan 27, 2017
1 parent 47a831d commit 477db74
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -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
```
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Expand Up @@ -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": {
Expand Down
5 changes: 3 additions & 2 deletions src/SqlDoctor.php
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Database\DatabaseManager;
use Illuminate\Events\Dispatcher as Event;
use Illuminate\Foundation\Http\Events\RequestHandled;

class SqlDoctor
{
Expand All @@ -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']);
}
Expand Down

0 comments on commit 477db74

Please sign in to comment.