eb57be730b
- Settings Key-Value Store (DB + Cache) - Einstellungen → Layout: Seitenname, Logo, Button-Farbe, Dark/Light-Mode - Hilfe-Menü (Ebene 0): Handbuch + Changelog im Browser - Navigation erweitert: Einstellungen-Dropdown + Hilfe-Dropdown - CHANGELOG v0.4.0 Version: 0.4.0
34 lines
948 B
PHP
34 lines
948 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Services\SettingsService;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Support\Facades\View;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class SettingsServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(SettingsService::class);
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
// Settings nur laden wenn die Tabelle existiert (z.B. vor Migration schützen)
|
|
if (!$this->app->runningInConsole() && Schema::hasTable('settings')) {
|
|
$settings = $this->app->make(SettingsService::class)->all();
|
|
|
|
View::share('appSettings', $settings);
|
|
} else {
|
|
View::share('appSettings', [
|
|
'site_name' => config('app.name'),
|
|
'site_logo' => '',
|
|
'button_color' => '#4f46e5',
|
|
'theme_mode' => 'light',
|
|
]);
|
|
}
|
|
}
|
|
}
|