<?php

namespace App\Livewire;

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

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

    public function mount()
    {
        $this->loadCardMembers();  // Load users initially
    }

    public function loadCardMembers()
    {
        $this->cardMembers = collect(json_decode(file_get_contents(storage_path('app/c-member.json')), true));
    }

    public function render()
    {
        return view('livewire.member-management.card-member', [
            'card_members' => $this->cardMembers,  // Pass all users to the table
        ]);
    }
}
