From 7bba5e71a621a6afe9c93b1d161703c42fac7908 Mon Sep 17 00:00:00 2001 From: hskwon Date: Tue, 2 Dec 2025 20:50:25 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20MenuService=EA=B0=80=20global=5Fmen?= =?UTF-8?q?us=20=ED=85=8C=EC=9D=B4=EB=B8=94=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getAvailableGlobalMenus(): GlobalMenu 모델 사용 - copyFromGlobal(): GlobalMenu 모델 사용 - Menu::whereNull('tenant_id') → GlobalMenu::query()로 변경 --- app/Models/Commons/GlobalMenu.php | 2 +- app/Services/MenuService.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Models/Commons/GlobalMenu.php b/app/Models/Commons/GlobalMenu.php index 3debf8d2..05cdc675 100644 --- a/app/Models/Commons/GlobalMenu.php +++ b/app/Models/Commons/GlobalMenu.php @@ -146,4 +146,4 @@ public static function getMenuTree(): array return $menus->toArray(); } -} \ No newline at end of file +} diff --git a/app/Services/MenuService.php b/app/Services/MenuService.php index f0539771..6a2ff56c 100644 --- a/app/Services/MenuService.php +++ b/app/Services/MenuService.php @@ -2,6 +2,7 @@ namespace App\Services; +use App\Models\Commons\GlobalMenu; use App\Models\Commons\Menu; use App\Models\Tenants\Tenant; use Illuminate\Contracts\Pagination\LengthAwarePaginator; @@ -449,8 +450,8 @@ private function compactSiblings(?int $parentId): void */ public function getAvailableGlobalMenus(int $tenantId): Collection { - // 글로벌 메뉴 전체 조회 - $globalMenus = Menu::whereNull('tenant_id') + // 글로벌 메뉴 전체 조회 (global_menus 테이블에서) + $globalMenus = GlobalMenu::query() ->where('is_active', true) ->orderBy('parent_id') ->orderBy('sort_order') @@ -480,8 +481,8 @@ public function copyFromGlobal(int $tenantId, array $menuIds): array return ['success' => false, 'message' => '복사할 메뉴를 선택해주세요.', 'copied' => 0]; } - // 선택된 글로벌 메뉴 조회 - $globalMenus = Menu::whereNull('tenant_id') + // 선택된 글로벌 메뉴 조회 (global_menus 테이블에서) + $globalMenus = GlobalMenu::query() ->whereIn('id', $menuIds) ->orderBy('parent_id') // 부모 먼저 복사하기 위해 ->orderBy('sort_order')