From 12f5d9e28081d01b347af1d43002f2b30858f25f Mon Sep 17 00:00:00 2001 From: kent Date: Sat, 27 Dec 2025 23:40:33 +0900 Subject: [PATCH] =?UTF-8?q?fix(board):=20=ED=85=8C=EB=84=8C=ED=8A=B8=20?= =?UTF-8?q?=EA=B2=8C=EC=8B=9C=ED=8C=90=20=EB=A9=94=EB=89=B4=20=EC=9A=B0?= =?UTF-8?q?=EC=84=A0=EC=88=9C=EC=9C=84=20=EB=B0=8F=20=EB=9D=BC=EC=9A=B0?= =?UTF-8?q?=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 테넌트 게시판 부모 메뉴 우선순위 변경: /boards → /customer-center - 테넌트 게시판 리다이렉트 라우트 추가: /boards/{code} → /boards/{id}/posts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- app/Services/MenuService.php | 10 ++++------ routes/web.php | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/Services/MenuService.php b/app/Services/MenuService.php index db240f70..83c07142 100644 --- a/app/Services/MenuService.php +++ b/app/Services/MenuService.php @@ -1173,13 +1173,10 @@ public function copyFromGlobal(int $tenantId, array $menuIds): array */ public function findParentMenuForBoard(bool $isSystem, ?int $tenantId = null): ?int { - // 우선순위 URL 목록 - $priorityUrls = ['/customer-center']; - if ($isSystem) { // 시스템 게시판: global_menus에서 찾기 - $priorityUrls[] = '/system-boards'; - $priorityUrls[] = '/boards'; + // 우선순위: /customer-center → /system-boards → /boards → null + $priorityUrls = ['/customer-center', '/system-boards', '/boards']; foreach ($priorityUrls as $url) { $menu = GlobalMenu::where('url', $url) @@ -1194,7 +1191,8 @@ public function findParentMenuForBoard(bool $isSystem, ?int $tenantId = null): ? return null; // 최상위로 추가 } else { // 테넌트 게시판: menus에서 찾기 - $priorityUrls[] = '/boards'; + // 우선순위: /boards → /customer-center → null + $priorityUrls = ['/boards', '/customer-center']; foreach ($priorityUrls as $url) { $query = Menu::where('url', $url) diff --git a/routes/web.php b/routes/web.php index 95b5ec2c..830c2469 100644 --- a/routes/web.php +++ b/routes/web.php @@ -124,6 +124,23 @@ Route::get('/create', [BoardController::class, 'create'])->name('create'); Route::get('/{id}/edit', [BoardController::class, 'edit'])->name('edit'); + // 테넌트 게시판 리다이렉트 (board_code → boards/{id}/posts) + Route::get('/{code}', function (string $code) { + // 숫자만 있는 경우 (기존 라우트와 충돌 방지) + if (is_numeric($code)) { + abort(404); + } + + $tenantId = session('selected_tenant_id'); + + $board = \App\Models\Boards\Board::where('board_code', $code) + ->where('tenant_id', $tenantId) + ->where('is_active', true) + ->firstOrFail(); + + return redirect()->route('boards.posts.index', $board->id); + })->name('tenant-board')->where('code', '[a-zA-Z][a-zA-Z0-9_-]*'); + // 게시글 CRUD (board 하위 중첩 라우트) Route::prefix('{board}/posts')->name('posts.')->group(function () { Route::get('/', [PostController::class, 'index'])->name('index');