refactor: MenuService가 global_menus 테이블 사용하도록 수정
- getAvailableGlobalMenus(): GlobalMenu 모델 사용
- copyFromGlobal(): GlobalMenu 모델 사용
- Menu::whereNull('tenant_id') → GlobalMenu::query()로 변경
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user