관리-도구
편집 파일: AppServiceProvider.php
<?php namespace App\Providers; use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Request; use App\Models\User; use App\Models\Seo; use App\Models\Keyword; class AppServiceProvider extends ServiceProvider { public function register() { // } public function boot() { View::composer('*', function ($view) { $user = \App\Models\User::find(1); // Get current path — fallback to 'home' if root $currentPath = trim(Request::path(), '/'); $currentPage = $currentPath === '' ? 'home' : $currentPath; // Fetch SEO for this page $seo = \App\Models\Seo::where('page', $currentPage)->first(); // Get keywords $keywords = \App\Models\Keyword::pluck('keyword')->implode(', '); $view->with([ 'authUser' => $user, 'seoTitle' => $seo->title ?? 'Madhurans Event Center', 'seoDescription' => $seo->description ?? 'Madhurans Event Center', 'seoKeywords' => $keywords ]); }); } }