roomTypes = ['all' => '全部'] + collect(RoomType::cases())->mapWithKeys(fn($e) => [$e->value => $e->labels()])->toArray(); } public function render() { $branch = Branch::first(); $this->branchName = $branch->name ?? ''; $rooms = collect(); // 預設為空集合 $floors = []; if ($branch) { $rooms = Room::where('branch_id', $branch->id)->orderBy('name', 'asc')->get(); $floors = $rooms->pluck('floor')->unique()->sort()->values()->toArray(); } return view('livewire.forms.room-grid-form', [ 'rooms' => $rooms, 'floors' => $floors, ]); } }