Skip to content

Commit

Permalink
Detect app.debug if enabled is null
Browse files Browse the repository at this point in the history
Fixes barryvdh#285
It cannot be guaranteed that app.debug is loaded before debugbar.
  • Loading branch information
barryvdh committed Feb 19, 2015
1 parent 77b9cc0 commit 7bdf8ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config/debugbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
|--------------------------------------------------------------------------
|
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
|
*/

'enabled' => config('app.debug'),
'enabled' => null,

/*
|--------------------------------------------------------------------------
Expand Down
10 changes: 9 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,15 @@ public function boot()
]);
});

if (! $this->app['config']->get('debugbar.enabled')) {
$enabled = $this->app['config']->get('debugbar.enabled');

// If enabled is null, set from the app.debug value
if (is_null($enabled)) {
$enabled = $this->app['config']->get('app.debug');
$this->app['config']->set('debugbar.enabled', $enabled);
}

if ( ! $enabled) {
return;
}

Expand Down

0 comments on commit 7bdf8ac

Please sign in to comment.