I'm using Laravel 4.1 to write an application. For some reason I need to disable debug in all environments including production, but I need to provide a means for users to be able to enable debug mode without editing configuration files (app.php) whenever needed (that means at runtime)
Is there a way to do so? I tried to change debug settings in App::before but that does not seem to be the correct solution (exception handlers are already registered at that point)
Update:
In last paragraph I said
exception handlers are already registered at that point
This comment is misleading I think. Exception handlers should be registered anyway.
The actual problem I need to solve is: How to change which displayer (plainDisplayer or debugDisplayer) to use?
This decision is made at runtime (whenever an exception actually occures) based on value of a variable ($debug) in Illuminate\Exception\Handler
Calling app('exception')->setDebug(true) makes exception handler to use debug displayer but I'm not sure if this is the correct way to do it, specially if I'm going to put this code in App::before filter
Config::set('app.debug', true)in App::before based on a session value without any issues.app/filters.phpwe didApp::before(function($request) { Config::set('app.debug', Session::get('debug_mode', false)); });