From 79cf1b920ba625b0d5e3c255584fa81388186f3d Mon Sep 17 00:00:00 2001 From: "allen.yan" Date: Thu, 24 Jul 2025 11:08:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AA=BF=E6=95=B4=20room=20=E7=94=A8=20name=20?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=2020250724?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/BranchControlController.php | 2 +- app/Livewire/Admin/RoomGrid.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/BranchControlController.php b/app/Http/Controllers/BranchControlController.php index 84eda71..de45564 100644 --- a/app/Http/Controllers/BranchControlController.php +++ b/app/Http/Controllers/BranchControlController.php @@ -67,7 +67,7 @@ class BranchControlController extends Controller */ public function Branches(Request $request): JsonResponse { - $branches = Branch::with('rooms')->get()->map(function ($branch) { + $branches = Branch::with('rooms')->orderBy('name', 'asc')->get()->map(function ($branch) { return [ 'id' => $branch->id, 'branch_name' => $branch->name, diff --git a/app/Livewire/Admin/RoomGrid.php b/app/Livewire/Admin/RoomGrid.php index 2c7b195..9190b32 100644 --- a/app/Livewire/Admin/RoomGrid.php +++ b/app/Livewire/Admin/RoomGrid.php @@ -38,7 +38,7 @@ class RoomGrid extends Component public function render() { - $rooms = Room::where('branch_id', $this->branch_id)->get(); + $rooms = Room::where('branch_id', $this->branch_id)->orderBy('name', 'asc')->get(); // 取得樓層 $floors = $rooms->pluck('floor')->unique()->sort()->values()->toArray();