I found this Laravel Debugbar I would like to use in my app. But I want to enable it based on a condition. I tried adding my code in both register() and boot() method in the AppServiceProvider, where I put all other similar checks, but both don't work.
When changing the DEBUGBAR_ENABLED in the config, everything works as it should.
So I've set the default to false
and want to enable it only dynamically.
However, I just can't understand why the following happens:
With this code the debugbar works:
public function boot()
{
\Debugbar::enable();
}
With this code the debugbar throws 404 errors and doesn't work when the condition is met:
public function boot()
{
if (isset($_GET['debug']) && $_GET['debug'] === 'debugbar') {
\Debugbar::enable();
}
}
If anyone has an idea why this is happening, please explain!