feat:주일기업 기획 메뉴 추가 (견적/입찰/공사관리, 프로젝트관리/기성청구)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
78
database/seeders/JuilPlanningMenuSeeder.php
Normal file
78
database/seeders/JuilPlanningMenuSeeder.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Commons\Menu;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class JuilPlanningMenuSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$tenantId = 1;
|
||||
|
||||
// 대분류 "주일기업 기획" 메뉴가 이미 있는지 확인
|
||||
$existingParent = Menu::withoutGlobalScopes()
|
||||
->where('tenant_id', $tenantId)
|
||||
->where('name', '주일기업 기획')
|
||||
->whereNull('parent_id')
|
||||
->first();
|
||||
|
||||
if ($existingParent) {
|
||||
$this->command->info('주일기업 기획 메뉴가 이미 존재합니다.');
|
||||
return;
|
||||
}
|
||||
|
||||
// 최상위 메뉴 중 가장 큰 sort_order 찾기
|
||||
$maxSortOrder = Menu::withoutGlobalScopes()
|
||||
->where('tenant_id', $tenantId)
|
||||
->whereNull('parent_id')
|
||||
->max('sort_order') ?? 0;
|
||||
|
||||
// 대분류 메뉴 생성
|
||||
$parent = Menu::create([
|
||||
'tenant_id' => $tenantId,
|
||||
'parent_id' => null,
|
||||
'name' => '주일기업 기획',
|
||||
'url' => null,
|
||||
'icon' => 'building-2',
|
||||
'sort_order' => $maxSortOrder + 1,
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$this->command->info("대분류 메뉴 생성: 주일기업 기획 (sort_order: {$parent->sort_order})");
|
||||
|
||||
// 하위 메뉴 1: 견적/입찰/공사관리
|
||||
$menu1 = Menu::create([
|
||||
'tenant_id' => $tenantId,
|
||||
'parent_id' => $parent->id,
|
||||
'name' => '견적/입찰/공사관리',
|
||||
'url' => '/juil/estimate',
|
||||
'icon' => 'clipboard-list',
|
||||
'sort_order' => 1,
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$this->command->info("하위 메뉴 생성: {$menu1->name} ({$menu1->url})");
|
||||
|
||||
// 하위 메뉴 2: 프로젝트관리/기성청구
|
||||
$menu2 = Menu::create([
|
||||
'tenant_id' => $tenantId,
|
||||
'parent_id' => $parent->id,
|
||||
'name' => '프로젝트관리/기성청구',
|
||||
'url' => '/juil/project',
|
||||
'icon' => 'hard-hat',
|
||||
'sort_order' => 2,
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$this->command->info("하위 메뉴 생성: {$menu2->name} ({$menu2->url})");
|
||||
|
||||
// 결과 출력
|
||||
$this->command->info('');
|
||||
$this->command->info('=== 주일기업 기획 메뉴 구조 ===');
|
||||
$this->command->info("📁 {$parent->name} (id: {$parent->id})");
|
||||
$this->command->info(" ├─ {$menu1->name} → {$menu1->url}");
|
||||
$this->command->info(" └─ {$menu2->name} → {$menu2->url}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user