From 2cd9a57a3c799ccdaf9569ebed75da1efbc5f3c5 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Mon, 1 Aug 2022 20:30:41 -0600 Subject: [PATCH] Move registration to the register() method. Fixes #12. Credit to @lex0r for the original solution. Replaces #13. --- Plugin.php | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/Plugin.php b/Plugin.php index 1f59d89..eff76b7 100644 --- a/Plugin.php +++ b/Plugin.php @@ -1,9 +1,7 @@ alias('Debugbar', '\Barryvdh\Debugbar\Facade'); - // Register middleware if (Config::get('app.debugAjax', false)) { $this->app['Illuminate\Contracts\Http\Kernel']->pushMiddleware('\Winter\Debugbar\Middleware\InterpretsAjaxExceptions'); @@ -80,13 +68,21 @@ public function boot() } /** - * Register the + * Register the plugin */ public function register() { - /* - * Register asset bundles - */ + // Configure the debugbar + Config::set('debugbar', Config::get('winter.debugbar::config')); + + // Register the debugbar serviceprovider + $this->app->register(\Winter\Debugbar\Classes\ServiceProvider::class); + + // Register alias + $alias = AliasLoader::getInstance(); + $alias->alias('Debugbar', '\Barryvdh\Debugbar\Facade'); + + // Register asset bundles CombineAssets::registerCallback(function ($combiner) { $combiner->registerBundle('$/winter/debugbar/assets/css/debugbar.less'); });