<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\DB;
use App\Models\TypeItems;
use Kreait\Firebase\Factory;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        // $this->app->singleton('firebase.database', function () {
        //     $factory = (new Factory)->withServiceAccount(config_path('firebase_credentials.json'));
        //     return $factory->createDatabase();
        // });
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        // DB::statement("SET time_zone = '+07:00'");

        View::composer('components.layouts.app.sidebar', function ($view) {
            $view->with('typeitems', TypeItems::orderBy('name')->get());
        });
    }
}
