<?php

namespace App\Livewire;

use Livewire\Component;
use Livewire\Attributes\Layout;  // Required for layout declaration

#[Layout('layouts.dashboard')]  // Attribute syntax for Laravel 11
class RegistrationReport extends Component
{
    public $registrationReport = [];

    public function mount()
    {
        $this->loadRegistrationReport();  // Load registrationReport initially
    }

    public function loadRegistrationReport()
    {
        $this->registrationReport = collect(json_decode(file_get_contents(storage_path('app/registration-report.json')), true));
    }

    public function render()
    {
        return view('livewire.report.registration-report', [
            'registrationReport' => $this->registrationReport, 
        ]);
    }
}