KTV/app/Livewire/Admin/RoomGrid.php

36 lines
780 B
PHP

<?php
namespace App\Livewire\Admin;
use App\Models\Room;
use App\Models\Branch;
use Livewire\Component;
use Illuminate\Database\Eloquent\Collection;
class RoomGrid extends Component
{
protected $listeners = ['openModal','closeModal'];//,'refreshRooms' => '$refresh'
public bool $showModal = false;
public $branchName="";
public Collection $rooms;
public function mount()
{
$this->rooms = new Collection();
}
public function openModal($branch_id = null)
{
$this->branchName=Branch::where('id',$branch_id)->first()->name;
$this->rooms = Room::where('branch_id',$branch_id)->get();
$this->showModal = true;
}
public function render()
{
return view('livewire.admin.room-grid');
}
}