Skip to content

Commit 760f27d

Browse files
authored
Tweak serviceprovider (#1673)
1 parent d12312c commit 760f27d

File tree

2 files changed

+1
-40
lines changed

2 files changed

+1
-40
lines changed

src/LaravelDebugbar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ public function modifyResponse(Request $request, Response $response)
729729
{
730730
/** @var Application $app */
731731
$app = $this->app;
732-
if (!$this->isEnabled() || $this->isDebugbarRequest() || $this->responseIsModified) {
732+
if (!$this->isEnabled() || !$this->booted || $this->isDebugbarRequest() || $this->responseIsModified) {
733733
return $response;
734734
}
735735

src/ServiceProvider.php

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ public function boot()
102102

103103
$this->loadRoutesFrom(__DIR__ . '/debugbar-routes.php');
104104

105-
$this->registerResponseListener();
106105
$this->registerMiddleware(InjectDebugbar::class);
107106

108107
$this->commands(['command.debugbar.clear']);
@@ -128,16 +127,6 @@ protected function getConfigPath()
128127
return config_path('debugbar.php');
129128
}
130129

131-
/**
132-
* Publish the config file
133-
*
134-
* @param string $configPath
135-
*/
136-
protected function publishConfig($configPath)
137-
{
138-
$this->publishes([$configPath => config_path('debugbar.php')], 'config');
139-
}
140-
141130
/**
142131
* Register the Debugbar Middleware
143132
*
@@ -148,32 +137,4 @@ protected function registerMiddleware($middleware)
148137
$kernel = $this->app[Kernel::class];
149138
$kernel->pushMiddleware($middleware);
150139
}
151-
152-
/**
153-
* Register the Response Listener
154-
*
155-
* @param string $middleware
156-
*/
157-
protected function registerResponseListener()
158-
{
159-
if (!isset($this->app['events']) || !class_exists(ResponsePrepared::class)) {
160-
return;
161-
}
162-
163-
/**
164-
* For redirects, prepare the response early to store in the session.
165-
* For regular requests, get the stacked data early
166-
*/
167-
$this->app['events']->listen(ResponsePrepared::class, function (ResponsePrepared $event) {
168-
/** @var LaravelDebugbar $debugbar */
169-
$debugbar = $this->app->make(LaravelDebugbar::class);
170-
if ($debugbar->isEnabled()) {
171-
if ($event->response->isRedirection()) {
172-
$debugbar->modifyResponse($event->request, $event->response);
173-
} else {
174-
$debugbar->getStackedData();
175-
}
176-
}
177-
});
178-
}
179140
}

0 commit comments

Comments
 (0)