refactor: 회원가입 메뉴 복사 로직을 global_menus 테이블 기반으로 변경
- MenuBootstrapService: menus → global_menus 테이블에서 조회 - MenusStep: 신규 테넌트 부트스트랩 시 global_menus 사용 - GlobalMenuTemplateSeeder: GlobalMenu 모델 사용으로 변경
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Commons\Menu;
|
||||
use App\Models\Commons\GlobalMenu;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class GlobalMenuTemplateSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* 글로벌 메뉴 템플릿 시딩 (tenant_id = NULL)
|
||||
* 글로벌 메뉴 템플릿 시딩 (global_menus 테이블)
|
||||
* mes_react App.tsx의 SystemAdmin 메뉴 구조 기반
|
||||
*/
|
||||
public function run(): void
|
||||
@@ -227,38 +227,36 @@ public function run(): void
|
||||
],
|
||||
];
|
||||
|
||||
// 메뉴 생성
|
||||
// 메뉴 생성 (global_menus 테이블에 저장)
|
||||
foreach ($menus as $menuData) {
|
||||
$children = $menuData['children'] ?? null;
|
||||
unset($menuData['children']);
|
||||
|
||||
// 최상위 메뉴 생성 (tenant_id = null)
|
||||
$parentMenu = Menu::create([
|
||||
'tenant_id' => null,
|
||||
// 최상위 메뉴 생성 (global_menus 테이블)
|
||||
$parentMenu = GlobalMenu::create([
|
||||
'parent_id' => null,
|
||||
'name' => $menuData['name'],
|
||||
'url' => $menuData['url'],
|
||||
'icon' => $menuData['icon'],
|
||||
'sort_order' => $menuData['sort_order'],
|
||||
'is_active' => 1,
|
||||
'hidden' => 0,
|
||||
'is_external' => 0,
|
||||
'is_active' => true,
|
||||
'hidden' => false,
|
||||
'is_external' => false,
|
||||
'external_url' => null,
|
||||
]);
|
||||
|
||||
// 하위 메뉴 생성
|
||||
if ($children) {
|
||||
foreach ($children as $index => $childData) {
|
||||
Menu::create([
|
||||
'tenant_id' => null,
|
||||
GlobalMenu::create([
|
||||
'parent_id' => $parentMenu->id,
|
||||
'name' => $childData['name'],
|
||||
'url' => $childData['url'],
|
||||
'icon' => $childData['icon'],
|
||||
'sort_order' => $index + 1,
|
||||
'is_active' => 1,
|
||||
'hidden' => 0,
|
||||
'is_external' => 0,
|
||||
'is_active' => true,
|
||||
'hidden' => false,
|
||||
'is_external' => false,
|
||||
'external_url' => null,
|
||||
]);
|
||||
}
|
||||
@@ -266,6 +264,6 @@ public function run(): void
|
||||
}
|
||||
});
|
||||
|
||||
$this->command->info('✅ 글로벌 메뉴 템플릿 생성 완료 (약 60개 메뉴 항목)');
|
||||
$this->command->info('✅ 글로벌 메뉴 템플릿 생성 완료 (global_menus 테이블, 약 60개 항목)');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user