Skip to content

Commit fde0570

Browse files
committed
Always disable on console
Don't boot on Console. Fixes barryvdh#266
1 parent 29c0bd0 commit fde0570

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

config/debugbar.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,6 @@
6060

6161
'capture_ajax' => true,
6262

63-
/*
64-
|--------------------------------------------------------------------------
65-
| Capture Console Commands
66-
|--------------------------------------------------------------------------
67-
|
68-
| The Debugbar can listen to Artisan commands. You can view them with the browse button in the Debugbar.
69-
|
70-
*/
71-
72-
'capture_console' => false,
73-
7463
/*
7564
|--------------------------------------------------------------------------
7665
| DataCollectors

src/ServiceProvider.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ public function boot()
1818
{
1919
$app = $this->app;
2020

21-
if (!$app->runningInConsole()) {
22-
$app['router']->after(
23-
function ($request, $response) use ($app) {
24-
/** @var LaravelDebugbar $debugbar */
25-
$debugbar = $app['debugbar'];
26-
$debugbar->modifyResponse($request, $response);
27-
}
28-
);
21+
if ($app->runningInConsole()) {
22+
$this->app['config']->set('debugbar.enabled', false);
23+
}
24+
25+
if (! $this->app['config']->get('debugbar.enabled')) {
26+
return;
2927
}
3028

3129
$routeConfig = [
@@ -49,11 +47,16 @@ function ($request, $response) use ($app) {
4947
]);
5048
});
5149

52-
if ($this->app['config']->get('debugbar.enabled')) {
53-
/** @var LaravelDebugbar $debugbar */
54-
$debugbar = $this->app['debugbar'];
55-
$debugbar->boot();
56-
}
50+
/** @var LaravelDebugbar $debugbar */
51+
$debugbar = $this->app['debugbar'];
52+
$debugbar->boot();
53+
54+
$app['router']->after(
55+
function ($request, $response) use ($debugbar) {
56+
$debugbar->modifyResponse($request, $response);
57+
}
58+
);
59+
5760
}
5861

5962
/**

0 commit comments

Comments
 (0)