fix(board): 테넌트 게시판 메뉴 우선순위 및 라우트 수정
- 테넌트 게시판 부모 메뉴 우선순위 변경: /boards → /customer-center
- 테넌트 게시판 리다이렉트 라우트 추가: /boards/{code} → /boards/{id}/posts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user