Add global site settings view composer with database fallback
Implemented view composer in AppServiceProvider to share site settings across all views: - Loads site name, logo, colors (primary/secondary/accent), and description from Setting model - Falls back to config/defaults if database unavailable (prevents errors during migrations) - Made siteSettings available to all Blade templates Updated layouts and components to use dynamic settings: - app.blade.php and guest.blade.php now use siteSettings for
This commit is contained in:
@@ -5,12 +5,21 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<title>{{ config('app.name', 'Laravel') }}</title>
|
||||
<title>{{ $siteSettings['name'] ?? config('app.name', 'Laravel') }}</title>
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
||||
|
||||
<!-- Dynamic Colors from Settings -->
|
||||
<style>
|
||||
:root {
|
||||
--primary-color: {{ $siteSettings['primary_color'] ?? '#3b82f6' }};
|
||||
--secondary-color: {{ $siteSettings['secondary_color'] ?? '#8b5cf6' }};
|
||||
--accent-color: {{ $siteSettings['accent_color'] ?? '#10b981' }};
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Scripts -->
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user