<?php

namespace App\Livewire;

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

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

    public function mount()
    {
        $this->loadFuel();  // Load fuel initially
    }

    public function loadFuel()
    {
        $this->fuels = collect(json_decode(file_get_contents(storage_path('app/fuels.json')), true));
    }

    public function render()
    {
        return view('livewire.station-locator.fuel', [
            'fuels' => $this->fuels,  // Pass all fuel to the table
        ]);
    }
}
