Skip to content

Commit 77b9cc0

Browse files
committed
Swap register/boot order
1 parent fddfb08 commit 77b9cc0

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

src/ServiceProvider.php

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,44 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
99
*/
1010
protected $defer = false;
1111

12+
/**
13+
* Register the service provider.
14+
*
15+
* @return void
16+
*/
17+
public function register()
18+
{
19+
$configPath = __DIR__ . '/../config/debugbar.php';
20+
$this->mergeConfigFrom($configPath, 'debugbar');
21+
22+
$this->app->alias(
23+
'DebugBar\DataFormatter\DataFormatter',
24+
'DebugBar\DataFormatter\DataFormatterInterface'
25+
);
26+
27+
$this->app['debugbar'] = $this->app->share(
28+
function ($app) {
29+
$debugbar = new LaravelDebugBar($app);
30+
31+
$sessionManager = $app['session'];
32+
$httpDriver = new SymfonyHttpDriver($sessionManager);
33+
$debugbar->setHttpDriver($httpDriver);
34+
35+
return $debugbar;
36+
}
37+
);
38+
39+
$this->app->alias('debugbar', 'Barryvdh\Debugbar\LaravelDebugbar');
40+
41+
$this->app['command.debugbar.clear'] = $this->app->share(
42+
function ($app) {
43+
return new Console\ClearCommand($app['debugbar']);
44+
}
45+
);
46+
47+
$this->commands(array('command.debugbar.clear'));
48+
}
49+
1250
/**
1351
* Bootstrap the application events.
1452
*
@@ -62,44 +100,6 @@ function ($request, $response) use ($debugbar) {
62100

63101
}
64102

65-
/**
66-
* Register the service provider.
67-
*
68-
* @return void
69-
*/
70-
public function register()
71-
{
72-
$configPath = __DIR__ . '/../config/debugbar.php';
73-
$this->mergeConfigFrom($configPath, 'debugbar');
74-
75-
$this->app->alias(
76-
'DebugBar\DataFormatter\DataFormatter',
77-
'DebugBar\DataFormatter\DataFormatterInterface'
78-
);
79-
80-
$this->app['debugbar'] = $this->app->share(
81-
function ($app) {
82-
$debugbar = new LaravelDebugBar($app);
83-
84-
$sessionManager = $app['session'];
85-
$httpDriver = new SymfonyHttpDriver($sessionManager);
86-
$debugbar->setHttpDriver($httpDriver);
87-
88-
return $debugbar;
89-
}
90-
);
91-
92-
$this->app->alias('debugbar', 'Barryvdh\Debugbar\LaravelDebugbar');
93-
94-
$this->app['command.debugbar.clear'] = $this->app->share(
95-
function ($app) {
96-
return new Console\ClearCommand($app['debugbar']);
97-
}
98-
);
99-
100-
$this->commands(array('command.debugbar.clear'));
101-
}
102-
103103
/**
104104
* Get the services provided by the provider.
105105
*

0 commit comments

Comments
 (0)