<?php

namespace App\Http\Controllers;

use App\Http\Helpers\UserSystemInfoHelper;
use Illuminate\Http\Request;
use App\Models\{Utilisateur, Book, Book_Utilisateur, Etablissement};

class AboutController extends Controller
{
    public function create()
    {
        $namebase = Etablissement::where('idEtablissement', 11)->first()->namebase;
        UserSystemInfoHelper::changeEnv(['database' => $namebase]);

        $stats = [
            'user' => Utilisateur::all()->count() - 1,
            'livre' => Book::where('etat', 1)->count(),
            'emprunt' => Book_Utilisateur::all()->count()
        ];
        return view('about', compact('stats'));
    }
}
