In Laravel 4, I want to set the configuration variable "debug" to "false" by default, but to "true" for requests from my own IP address (the test will eventually be more sophisticated than that).
Based on the documentation at http://four.laravel.com/docs/configuration, I've tried the following:
config/app.php:
'debug' => false
filters.app - App::before (I also tried putting the code at the top of routes.php, with the same effect):
if(Request::getClientIp() == '[my ip address]') {
echo 'hello world';
Config::set('app.debug', true);
}
echo Config::get('app.debug');
When I visit a bad URL I see "hello world" and "1", so that's good, but then just the public (non-debug) error message displays below that.
I understand config variables set at run-time are only for a single request, but since my "hello world" is displaying, it seems like this is a single request.
Is there a better place to put my code, or is what I'm doing not actually possible?