From f3eaa9c715d5209f51a7b573acefcd5bec9e734e Mon Sep 17 00:00:00 2001 From: "allen.yan" Date: Thu, 24 Jul 2025 11:17:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AA=BF=E6=95=B4=20API=20=E5=8C=85=E5=B8=B3?= =?UTF-8?q?=20=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/BranchControlController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/BranchControlController.php b/app/Http/Controllers/BranchControlController.php index de45564..fa01d01 100644 --- a/app/Http/Controllers/BranchControlController.php +++ b/app/Http/Controllers/BranchControlController.php @@ -67,7 +67,9 @@ class BranchControlController extends Controller */ public function Branches(Request $request): JsonResponse { - $branches = Branch::with('rooms')->orderBy('name', 'asc')->get()->map(function ($branch) { + $branches = Branch::with(['rooms' => function ($query) { + $query->orderBy('name', 'asc'); // 對 rooms ηš„ name ζŽ’εΊ + }])->get()->map(function ($branch) { return [ 'id' => $branch->id, 'branch_name' => $branch->name,