<?php

namespace App\Http\Controllers\Admins;

use App\Http\Controllers\Controller;
use App\Models\AgendaGuestBooks;
use App\Models\Agendas;
use App\Models\Appointments;
use App\Models\DataRequests;
use App\Models\User;
use Illuminate\Http\Request;

class DashboardController extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function index()
    {
        // Call view Dashboard
        return view('pages.admins.dashboard', $this->total());
    }

    // Total Request
    public function total()
    {
        // // Data Request
        // $total = DataRequests::count();
        // $total = DataRequests::where('status', 'Rejected')->count();
        // $total = DataRequests::whereYear('created_at', '2023')->count();
        // $total = DataRequests::whereMonth('created_at', '12')->count();

        // // Agenda
        // $total = Agendas::count();
        // $total = Agendas::whereYear('date', '2024')->count();
        // $total = Agendas::whereYear('date', '2024')->whereMonth('date', '01')->count();

        // // Guest Books
        // $total = AgendaGuestBooks::count();
        // $total = AgendaGuestBooks::where('agenda_id', 2)->count();
        // $total = Agendas::whereYear('date', '2024')->whereMonth('date', '01')->count();

        $totalUser = User::count();

        return compact('totalUser');
    }
}
