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();