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')