- Route Model Binding → 수동 조회로 변경 (board_code + tenant_id) - PostController: resolveBoard() 헬퍼 추가 - t 파라미터 → 시스템 게시판 → 로그인 회원 tenant 순서 - 사이드바 메뉴 리다이렉트: tenant_id ?? 1 fallback 추가 - SidebarMenuService와 동일한 로직으로 일관성 확보 - 게시판 목록 테이블에 게시글 수 컬럼 추가 - 모든 posts View에 tenant_id 파라미터 추가 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
155 lines
7.9 KiB
PHP
155 lines
7.9 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', $board->name)
|
|
|
|
@section('content')
|
|
<!-- 페이지 헤더 -->
|
|
<div class="flex justify-between items-center mb-6">
|
|
<div>
|
|
<h1 class="text-2xl font-bold text-gray-800">{{ $board->name }}</h1>
|
|
@if($board->description)
|
|
<p class="text-sm text-gray-500 mt-1">{{ $board->description }}</p>
|
|
@endif
|
|
</div>
|
|
<div class="flex items-center gap-3">
|
|
<a href="{{ route('boards.posts.create', ['boardCode' => $board->board_code, 't' => $board->tenant_id]) }}"
|
|
class="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-sm font-medium transition flex items-center gap-2">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
|
|
</svg>
|
|
글쓰기
|
|
</a>
|
|
<a href="{{ route('boards.index') }}"
|
|
class="px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-sm font-medium transition flex items-center gap-2">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h16M4 18h16"/>
|
|
</svg>
|
|
게시판 목록
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 통계 카드 -->
|
|
<div class="grid grid-cols-4 gap-4 mb-6">
|
|
<div class="bg-white rounded-lg shadow-sm p-4">
|
|
<div class="text-sm text-gray-500">전체 게시글</div>
|
|
<div class="text-2xl font-bold text-gray-900">{{ number_format($stats['total']) }}</div>
|
|
</div>
|
|
<div class="bg-white rounded-lg shadow-sm p-4">
|
|
<div class="text-sm text-gray-500">공지사항</div>
|
|
<div class="text-2xl font-bold text-blue-600">{{ number_format($stats['notices']) }}</div>
|
|
</div>
|
|
<div class="bg-white rounded-lg shadow-sm p-4">
|
|
<div class="text-sm text-gray-500">오늘 작성</div>
|
|
<div class="text-2xl font-bold text-green-600">{{ number_format($stats['today']) }}</div>
|
|
</div>
|
|
<div class="bg-white rounded-lg shadow-sm p-4">
|
|
<div class="text-sm text-gray-500">게시 중</div>
|
|
<div class="text-2xl font-bold text-gray-600">{{ number_format($stats['published']) }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 검색 -->
|
|
<div class="bg-white rounded-lg shadow-sm p-4 mb-6">
|
|
<form action="{{ route('boards.posts.index', ['boardCode' => $board->board_code, 't' => $board->tenant_id]) }}" method="GET" class="flex items-center gap-4">
|
|
<input type="hidden" name="t" value="{{ $board->tenant_id }}">
|
|
<div class="flex-1">
|
|
<input type="text" name="search" value="{{ $filters['search'] ?? '' }}"
|
|
placeholder="제목, 내용 검색..."
|
|
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
<button type="submit" class="px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg transition">
|
|
검색
|
|
</button>
|
|
@if(!empty($filters['search']))
|
|
<a href="{{ route('boards.posts.index', ['boardCode' => $board->board_code, 't' => $board->tenant_id]) }}" class="px-4 py-2 text-gray-500 hover:text-gray-700">
|
|
초기화
|
|
</a>
|
|
@endif
|
|
</form>
|
|
</div>
|
|
|
|
<!-- 게시글 목록 -->
|
|
<div class="bg-white rounded-lg shadow-sm overflow-hidden">
|
|
<table class="min-w-full divide-y divide-gray-200">
|
|
<thead class="bg-gray-50">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-16">번호</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">제목</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-32">작성자</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-32">작성일</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-20">조회</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
|
@forelse($posts as $post)
|
|
<tr class="hover:bg-gray-50 {{ $post->is_notice ? 'bg-blue-50' : '' }}">
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
|
@if($post->is_notice)
|
|
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800">
|
|
공지
|
|
</span>
|
|
@else
|
|
{{ $post->id }}
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<a href="{{ route('boards.posts.show', ['boardCode' => $board->board_code, 'post' => $post, 't' => $board->tenant_id]) }}"
|
|
class="text-gray-900 hover:text-blue-600 font-medium">
|
|
@if($post->is_secret)
|
|
<svg class="w-4 h-4 inline-block text-gray-400 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/>
|
|
</svg>
|
|
@endif
|
|
{{ $post->title }}
|
|
</a>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
|
{{ $post->author?->name ?? '알 수 없음' }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
|
{{ $post->created_at->format('Y-m-d') }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
|
{{ number_format($post->views) }}
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="5" class="px-6 py-12 text-center text-gray-500">
|
|
<svg class="w-12 h-12 mx-auto text-gray-300 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
|
|
</svg>
|
|
<p>게시글이 없습니다.</p>
|
|
<a href="{{ route('boards.posts.create', ['boardCode' => $board->board_code, 't' => $board->tenant_id]) }}" class="mt-2 inline-block text-blue-600 hover:text-blue-800">
|
|
첫 게시글 작성하기
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
|
|
<!-- 페이지네이션 -->
|
|
@if($posts->hasPages())
|
|
<div class="px-6 py-4 border-t border-gray-200">
|
|
{{ $posts->withQueryString()->links() }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
<!-- 알림 메시지 -->
|
|
@if(session('success'))
|
|
<div class="fixed bottom-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg" id="toast">
|
|
{{ session('success') }}
|
|
</div>
|
|
<script>setTimeout(() => document.getElementById('toast')?.remove(), 3000);</script>
|
|
@endif
|
|
|
|
@if(session('error'))
|
|
<div class="fixed bottom-4 right-4 bg-red-500 text-white px-6 py-3 rounded-lg shadow-lg" id="toast-error">
|
|
{{ session('error') }}
|
|
</div>
|
|
<script>setTimeout(() => document.getElementById('toast-error')?.remove(), 3000);</script>
|
|
@endif
|
|
@endsection |