Hello, Could you specify on what purpose do you want to do that?
Maybe a better solution would be to create a config file and reach it by: Config::get('common.yourSetting') in laravel 4 and config('common.yourSetting') in laravel 5?
Or you could use a View Composer:
View composers are callbacks or class methods that are called when a view is rendered. If you have data that you want to be bound to a view each time that view is rendered, a view composer organizes that logic into a single location.
ModestasV said:
Hello, Could you specify on what purpose do you want to do that?
Maybe a better solution would be to create a config file and reach it by: Config::get('common.yourSetting') in laravel 4 and config('common.yourSetting') in laravel 5?
Yep, I'm using Laravel 5. Please help me for details.
Xum said:
Or you could use a View Composer:
View composers are callbacks or class methods that are called when a view is rendered. If you have data that you want to be bound to a view each time that view is rendered, a view composer organizes that logic into a single location.
I'm using view-composers but they are callbacks function, I can't override it on any controllers. I want if Array variable $commonConfig is not define in Controller, it's call. if in controller is define it, it is override.
rusticboy103 said:
Yep, I'm using Laravel 5. Please help me for details.
As i said, create new file in config. Ex. config/myConfig.php which will return an array. Then you can get it easilly by calling config('myConfig.configVariable') or set it in controller to use for specific page.
Docs: http://laravel.com/docs/5.0/configuration#accessing-configuration-values
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community