Comments (8)
Hey everyone!
I was able to fix this by making sure the plugin can make use of Laravel Debugbar's config files to ignore the missing auth
class that is causing these exceptions.
Since you can't use php artisan publish
in OctoberCMS you have to cheat a little bit by providing a own config.php
where you copy the contents of Laravel Debugbar's debugbar.php
options and write them into the namespace of the package in October at runtime. If you guys think this fix is good enough, I can make a PR. Let me know if you guys think I forgot anything. Here goes!
Steps to follow to fix the issue
Adding Laravel Debugbar's config file to the Plugin
-
Install the plugin as you usually do (composer or marketplace, up to you).
-
After the installation has completed, go to the plugin's
vendor
folder and copy the contents of Laravel Debugbar's config file. It can usually be found at this location :/plugins/bedard/debugbar/vendor/barryvdh/laravel-debugbar/config/debugbar.php
. -
Go to the root of this plugin's folder and create a new folder called
config
. -
In this folder create a new file name
config.php
. -
Paste the contents of the
debugbar.php
file into the newconfig.php
file as is.
You should now have a file at the following location with the contents of the Laravel Debugbar's config file :
/plugins/bedard/debugbar/config/config.php
Loading the config file at runtime
-
Edit
/plugins/bedard/debugbar/Plugin.php
. -
Add this namespace at the top of the file :
use Config;
- Add these lines to your the
boot
function:
// Setup configurations
$config = Config::get('bedard.debugbar::config');
if (!is_null($config)) {
Config::set('debugbar', $config);
}
Your boot function should now look something like this :
/**
* Register service provider, Twig extensions, and alias facade.
*/
public function boot()
{
// Service provider
App::register('\Barryvdh\Debugbar\ServiceProvider');
// Setup configurations
$config = Config::get('bedard.debugbar::config');
if (!is_null($config)) {
Config::set('debugbar', $config);
}
// 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('\Bedard\Debugbar\Middleware\Debugbar');
}
Event::listen('cms.page.beforeDisplay', function ($controller, $url, $page) {
// Only show for authenticated backend users
if (!BackendAuth::check()) {
Debugbar::disable();
}
// Twig extensions
$twig = $controller->getTwig();
if (!$twig->hasExtension(\Barryvdh\Debugbar\Twig\Extension\Debug::class)) {
$twig->addExtension(new \Barryvdh\Debugbar\Twig\Extension\Debug($this->app));
$twig->addExtension(new \Barryvdh\Debugbar\Twig\Extension\Stopwatch($this->app));
}
});
}
Fixing the exceptions
Now that all this is done, you can go edit your local /plugins/bedard/debugbar/config/config.php
and set the auth
loading option that is causing the exceptions to false
as follows :
// ...
/*
|--------------------------------------------------------------------------
| DataCollectors
|--------------------------------------------------------------------------
|
| Enable/disable DataCollectors
|
*/
'collectors' => [
// ...
'auth' => false, // Display Laravel authentication status
// ...
],
// ...
from debugbar-plugin.
Replace every steps above, for easier to fix it, just edit the file:
/plugins/bedard/debugbar/Plugin.php
and add the code below on top of the boot() function:
$config = \Config::get('debugbar', []);
if (isset($config['collectors']['auth'])) {
$config['collectors']['auth'] = false;
$config = \Config::set('debugbar', $config);
}
from debugbar-plugin.
I had the same exceptions and I was able to fix it with this code in the file:
plugins/bedard/debugbar/barryvdh/laravel-debugbar/src/LaravelDebugbar.php
Now I get these errors and I don't know how to fix it...
Cannot add AuthCollector to Laravel Debugbar: Class auth does not exist /.../plugins/bedard/debugbar/vendor/barryvdh/laravel-debugbar/src/LaravelDebugbar.php#454
Class auth does not exist /.../vendor/laravel/framework/src/Illuminate/Container/Container.php#752
Can someone help? Has anyone seen this before?
I am using OctoberCMS 434, PHP 7.0 and Debugbar 2.0.0
from debugbar-plugin.
Is this plugin abandoned?
from debugbar-plugin.
I hope not! It's a great plugin, and I am still using it despite the errors.
from debugbar-plugin.
There's always the option to fix the issues yourself and send in a pull request. 😉
from debugbar-plugin.
Sorry, I've been focused on other projects and haven't had time to dig into this. I like @eXpl0it3r's suggestion though, I'd happily accept a PR that addressed this issue :)
from debugbar-plugin.
I was able to clean this up by using the suggestion provided by @tientamle along with editing:
.../plugins/bedard/debugbar/vendor/barryvdh/laravel-debugbar/config/debugbar.php
and setting collectors['auth'] to 'false'. (line 196 in my case).
from debugbar-plugin.
Related Issues (20)
- Plugin is hidden on the marketplace HOT 4
- Installed from Marketplace doesn't work (v3.0.0) HOT 5
- Failed to install from repository HOT 1
- Models collector does not work with October (Laravel 5.5 only) HOT 3
- Debug bar is still enabled even if plugin is disabled HOT 9
- Error when saving data from backend HOT 4
- v3.1.0 does't work HOT 11
- 500 Server Error after install ? HOT 12
- Plugin availability. HOT 1
- The plugin is hidden and cannot be installed - via artisan plugin:install HOT 3
- REST API profiling in 3.1.0 HOT 6
- Improve quality of event performance tracking HOT 4
- issues with debugAjax = true HOT 2
- Composer install crash the whole application HOT 2
- how to install DebugBar to octobercms version 470? HOT 1
- New Collectors HOT 7
- OctoberModelsCollector causes models not able to being serialized HOT 1
- Uncaught TypeError: url.indexOf is not a function HOT 1
- Twig "debug" functionality broken HOT 2
- Incompatible with latest Barryvdh\Debugbar HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from debugbar-plugin.