30 lines
699 B
PHP
30 lines
699 B
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use Livewire\Component;
|
|
use Livewire\Attributes\Layout; // Required for layout declaration
|
|
|
|
#[Layout('layouts.dashboard')] // Attribute syntax for Laravel 11
|
|
class Branch extends Component
|
|
{
|
|
public $branches = [];
|
|
|
|
public function mount()
|
|
{
|
|
$this->loadBranches(); // Load branches initially
|
|
}
|
|
|
|
public function loadBranches()
|
|
{
|
|
$this->branches = collect(json_decode(file_get_contents(storage_path('app/branches.json')), true));
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.station-locator.branch', [
|
|
'branches' => $this->branches, // Pass all branches to the table
|
|
]);
|
|
}
|
|
}
|