<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        // View Composer per la sidebar
        View::composer([
            'components.menu.sidebar', 
            'layouts.app-universal',
            'superadmin.dashboard', 
            'admin.dashboard'
        ], \App\View\Composers\SidebarComposer::class);
        
        // Helper per le impostazioni utente
        if (!function_exists('userSetting')) {
            function userSetting($key, $default = null) {
                return \App\Models\UserSetting::get($key, $default);
            }
        }
    }
}
