File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ class ServiceProvider extends BaseServiceProvider
1313 */
1414 public function boot ()
1515 {
16+ // Obey the same rules of laravel debugbar so we do not enable profiling where is not expected too.
17+ if (!$ this ->isEnabled ()) {
18+ return ;
19+ }
20+
1621 if ($ this ->app ->runningInConsole ()) {
1722 $ this ->commands ([
1823 Debug::class,
@@ -37,4 +42,18 @@ public function register()
3742 {
3843 $ this ->app ->register (DebugbarServiceProvider::class);
3944 }
45+
46+ /**
47+ * @return bool
48+ */
49+ protected function isEnabled ()
50+ {
51+ $ enabled = $ this ->app ['config ' ]->get ('debugbar.enabled ' );
52+
53+ if (is_null ($ enabled )) {
54+ $ enabled = $ this ->app ['config ' ]->get ('app.debug ' );
55+ }
56+
57+ return (bool ) $ enabled ;
58+ }
4059}
You can’t perform that action at this time.
0 commit comments