<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Appointment;
use App\Models\ContactMessage;
use App\Models\Service;
use App\Models\Blog;

class DashboardController extends Controller
{
    public function index()
    {
        $appointmentsCount = Appointment::count();
        $messagesCount = ContactMessage::count();
        $servicesCount = Service::count();
        $blogsCount = Blog::count();
        
        $recentAppointments = Appointment::latest()->take(5)->get();
        $recentMessages = ContactMessage::latest()->take(5)->get();

        return view('admin.dashboard', compact(
            'appointmentsCount', 
            'messagesCount', 
            'servicesCount', 
            'blogsCount',
            'recentAppointments',
            'recentMessages'
        ));
    }
}
