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

Hello @clakey

try this,

// You can keep this in your filters.php file

App::before(function($request) {
App::singleton('site_settings', function(){
	$site_settings = Setting::all();
	return $site_settings;
});

// If you use this line of code then it'll be available in any view
// as $site_settings but you may also use app('site_settings') as well
View::share('site_settings', app('site_settings'));
});

To get the same data in any controller you may use:

$site_settings = app('site_settings');
Last updated 9 years ago.
0

@mizan3008,

Thanks for your reply, but I think your code may be written for Laravel 4.x, when I am using Laravel 5!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Clarkey clarkey Joined 11 Mar 2014

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.