<?php

namespace App\Http\Controllers\Controllers;

use App\Http\Controllers\Controller;
use App\Models\Attendance;
use App\Models\User;
use Illuminate\Http\Request;

class DashboardController extends Controller
{
    public function index()
    {
        $data = Attendance::with('user')->where('date', now()->format('Y-m-d'))->get();
        $lengthAttendance = $data->count();
        $lengthEmployee = User::count();
        $izin = Attendance::where('status', 'izin')->where('date', now()->format('Y-m-d'))->get();
        return view('admin.features.dashboard.dashboard', compact('data', 'lengthAttendance', 'lengthEmployee', 'izin'));
    }
}
