In Laravel 5 you should use Config in a ServiceProvider or a Middleware. You can see both examples in the following SO question:
http://stackoverflow.com/questions/28356193/laravel-5-share-variables-in-service-providers
Do never touch index.php, it is immaculate.
Thanks but I am using Laravel in a Windows IIS environment and Windows Authentication. Since everything goes through index.php when you hit the site, that is where the 401 challenge takes place. In Laravel 4 I can use Config::set() from index.php to capture the user's login ID so I can use it throughout the application.
If I debug and put a breakpoint on Config::set() I can see it being set. However when I put a breakpoint on Config::get() in one of my controllers the key is not in the array. So even though it gets set...it is wiped out.
Yes that works but doesn't solve my issue. The 401 challenge is on the index.php file, it can't be on the routes file because that is not the document root. This means that once the 401 challenge is complete on the index.php file the $_SERVER credentials are tossed.
Ok, you can try a terminable middleware, it will inject data into the response, instead of the request.
http://laravel.com/docs/5.0/middleware#terminable-middleware
Have you tried using Session::put() and Session::get()? Or even plain $_SESSION in index.php?
guys what that's mean
<tiitle>{{ config('app.name', 'my application') }}</title>
it means get app.name from config if defined else use 'my application' as the default value
meduprise said:
guys what that's mean
<tiitle>{{ config('app.name', 'my application') }}</title>
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community