<?php

namespace App\Livewire;

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

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

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

    public function loadCardTypes()
    {
        // Load card types from JSON file
        $this->cardTypes = collect(json_decode(file_get_contents(storage_path('app/card-types.json')), true));
    }

    public function render()
    {
        return view('livewire.about-us.card-type', [
            'users' => $this->cardTypes,  // Pass all users to the table
        ]);
    }
}
