Phil Phil - 1 month ago 16
PHP Question

laravel how to read app/config/app.php debug variable

How do I access the debug variable in

app/config/app.php
from my controller to see if I am in debug mode?

<?php
|
/* | if ( $this->user->id )
|-------------------------------------------------------------------------- | {
| Application Debug Mode | // Save roles. Handles updating.
|-------------------------------------------------------------------------- | $this->user->saveRoles(Input::get( 'roles' ));
| |
| When your application is in debug mode, detailed error messages with | // Redirect to the new user page
| stack traces will be shown on every error that occurs within your | return Redirect::to('admin/users/'.$this->user->id)->with('success', Lang::get('admin/users/messages.cre
| application. If disabled, a simple generic error page is shown. |ate.success'));
| | }
*/ | else
| {
'debug' => true,

Answer

You can use the helper function config (Laravel 5+).

$debug = config('app.debug');

Laravel 4.2:

$debug = Config::get('app.debug');
Comments