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,