👁 查看:ViewServiceProvider.php
路径:/home/boguraj1/.trash/app.1/Providers/ViewServiceProvider.php
大小:1.46 KB · 修改:2026-07-17 23:25:22 · 权限:0644 · 可写
<?php
namespace App\Providers;
use App\Models\MenuItem;
use App\Models\Setting;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
class ViewServiceProvider extends ServiceProvider
{
public function boot()
{
View::composer('*', function ($view) {
try {
$view->with('menuItems', MenuItem::active()->get());
$view->with('siteName', Setting::get('site_name', config('app.name')));
$view->with('siteLogo', Setting::get('site_logo'));
$view->with('headerBanner', Setting::get('header_banner'));
$view->with('footerPhone', Setting::get('footer_phone', ''));
$view->with('footerEditor', Setting::get('footer_editor', ''));
$view->with('footerAddress', Setting::get('footer_address', ''));
$view->with('footerTagline', Setting::get('footer_tagline', ''));
$view->with('headerAd', Setting::get('header_ad', ''));
$view->with('socialFacebook', Setting::get('social_facebook', ''));
$view->with('socialTwitter', Setting::get('social_twitter', ''));
$view->with('socialYoutube', Setting::get('social_youtube', ''));
$view->with('socialInstagram', Setting::get('social_instagram', ''));
} catch (\Exception $e) {
// silently fail before first migration
}
});
}
}