調整 room 用 name 排序 20250724

This commit is contained in:
allen.yan 2025-07-24 11:08:50 +08:00
parent 0c7ad9070c
commit 79cf1b920b
2 changed files with 2 additions and 2 deletions

View File

@ -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,

View File

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