<?php

namespace App\Livewire;

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

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

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

    public function loadPhotoSliders()
    {
        $this->photoSliders = collect(json_decode(file_get_contents(storage_path('app/photo-sliders.json')), true));
    }

    public function render()
    {
        return view('livewire.home-page-mobile.photo-slider', [
            'photo_slider' => $this->photoSliders,  // Pass all users to the table
        ]);
    }
}
