php artisan make:provider SettingsServiceProvider app/Providers/SettingsServiceProvider.php namespace App\Providers; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; class SettingsServiceProvider extends ServiceProvider { public function boot() { // Load settings once and share globally $settings = DB::table('settings')->first(); View::share('settings', $settings); } public function register() { // } } config/app.php add App\Providers\SettingsServiceProvider::class
{{ $settings->title }}
Contact us at {{ $settings->email }} or {{ $settings->mobile }}
---------------- public function boot() { $settings = cache()->remember('settings', 60 * 60, function () { return DB::table('settings')->first(); }); View::share('settings', $settings); } public function update(Request $request) { cache()->forget('settings'); return redirect()->back()->with('success', 'Settings updated successfully!'); }