Skip to content

Commit 4b93163

Browse files
committed
Reverted config, updated output to array
1 parent 2c04eb4 commit 4b93163

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

config/config.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/*
55
* Enable or disable the query detection.
66
*/
7-
'enabled' => env('QUERY_DETECTOR_ENABLED', false),
7+
'enabled' => env('QUERY_DETECTOR_ENABLED', null),
88

99
/*
1010
* Here you can whitelist model relations.
@@ -21,7 +21,7 @@
2121
],
2222

2323
/*
24-
* Define the output format that you want to use.
24+
* Define the output formats that you want to use.
2525
* Available options are:
2626
*
2727
* Alert:
@@ -32,6 +32,8 @@
3232
* Writes the N+1 queries into the Laravel.log file
3333
* \BeyondCode\QueryDetector\Outputs\Log::class
3434
*/
35-
'output' => \BeyondCode\QueryDetector\Outputs\Alert::class,
36-
35+
'output' => [
36+
\BeyondCode\QueryDetector\Outputs\Log::class,
37+
\BeyondCode\QueryDetector\Outputs\Alert::class,
38+
]
3739
];

src/QueryDetector.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ public function boot()
2929

3030
public function isEnabled(): bool
3131
{
32-
$config = config('querydetector.enabled');
32+
$configEnabled = value(config('querydetector.enabled'));
3333

34-
return is_null($config) ? false : $config;
34+
if ($configEnabled === null) {
35+
$configEnabled = config('app.debug');
36+
}
37+
38+
return $configEnabled;
3539
}
3640

3741
public function logQuery($query, Collection $backtrace)

0 commit comments

Comments
 (0)