Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] Ability to disable the debugbar per controller #9

Closed
tougher opened this issue Oct 2, 2013 · 4 comments
Closed

[enhancement] Ability to disable the debugbar per controller #9

tougher opened this issue Oct 2, 2013 · 4 comments

Comments

@tougher
Copy link

tougher commented Oct 2, 2013

Hi

Nice package for Laravel!

I have a controller where i don't want to show the debugbar at all, even not on the dev env.

I've tried to set Config::set('laravel-debugbar::config.enabled', false); in a controllers constructor. But the check happens in the boot() function which is called before a controller constructor.

So I've made a change on line 196 in the ServiceProvider.php file, from:

if( $app->runningInConsole()){
    return;
}

to this:

if( $app->runningInConsole() || !$app['config']->get('laravel-debugbar::config.enabled')){
    return;
}

Is this the easiest way to disable the debugbar per controller?

@Anahkiasen
Copy link
Contributor

I'm thinking there's something bigger going on here, why exactly do you need to disable the bar for this particular controller ?

@barryvdh
Copy link
Owner

barryvdh commented Oct 2, 2013

Yeah I can check if the Debugbar is still enabled before actually adding the debugbar to the response, but curious why you need it off. It shouldn't interfere with non-html responses, or is it a styling issue?

@tougher
Copy link
Author

tougher commented Oct 2, 2013

I'm making a CMS/API to a smartphone app where some of the pages are opened directly in a webview (the cheaper solution). The customer is complaining about the debugbar interfering with the design.

Here is a screenshot of the info page in the iPhone simulator:

screen shot 2013-10-02 at 14 07 25

I don't care about the debugbar on thoes pages and I don't see why there should not be a way to turn it off.

@barryvdh
Copy link
Owner

barryvdh commented Oct 2, 2013

Okay, I would recommend that the client doesn't see the profiler at all, but I've added a check just before outputting the response.
You can set it with Config::set('laravel-debugbar::config.enabled', false); anywhere, just as long it is before the response is sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants