Skip to content

Commit

Permalink
Move registration to the register() method.
Browse files Browse the repository at this point in the history
Fixes #12. Credit to @lex0r for the original solution. Replaces #13.
  • Loading branch information
LukeTowers authored Aug 2, 2022
1 parent df995f5 commit 2cd9a57
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions Plugin.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php namespace Winter\Debugbar;

use App;
use Event;
use Config;
use BackendAuth;
use Backend\Models\UserRole;
use System\Classes\PluginBase;
use System\Classes\CombineAssets;
Expand Down Expand Up @@ -44,16 +42,6 @@ public function pluginDetails()
*/
public function boot()
{
// Configure the debugbar
Config::set('debugbar', Config::get('winter.debugbar::config'));

// Service provider
App::register(\Winter\Debugbar\Classes\ServiceProvider::class);

// Register alias
$alias = AliasLoader::getInstance();
$alias->alias('Debugbar', '\Barryvdh\Debugbar\Facade');

// Register middleware
if (Config::get('app.debugAjax', false)) {
$this->app['Illuminate\Contracts\Http\Kernel']->pushMiddleware('\Winter\Debugbar\Middleware\InterpretsAjaxExceptions');
Expand All @@ -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');
});
Expand Down

0 comments on commit 2cd9a57

Please sign in to comment.