refactor: MenuService가 global_menus 테이블 사용하도록 수정

- getAvailableGlobalMenus(): GlobalMenu 모델 사용
- copyFromGlobal(): GlobalMenu 모델 사용
- Menu::whereNull('tenant_id') → GlobalMenu::query()로 변경
This commit is contained in:
2025-12-02 20:50:25 +09:00
parent 0d12295495
commit 7bba5e71a6
2 changed files with 6 additions and 5 deletions

View File

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