<?php

namespace App\Providers;

use App\Helpers\AppConfig;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;

class AppConfigServiceProvider extends ServiceProvider
{
    public function register()
    {
        $this->app->singleton('appconfig', function ($app) {
            return new AppConfig();
        });
    }

    public function boot()
    {
        // Partager la config avec toutes les vues
        View::composer('*', function ($view) {
            $view->with('appConfig', AppConfig::all());
        });
    }
}