Support the ongoing development of Laravel.io →
Configuration Views Blade
Last updated 2 years ago.
0

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?

0

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.

Last updated 9 years ago.
0

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.

0

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.

0

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

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.