feat: 게시글 파일 첨부 기능 구현

- File 모델 추가 (Polymorphic 관계)
- Post 모델에 files() MorphMany 관계 추가
- PostService 파일 업로드/삭제/다운로드 메서드 추가
- PostController 파일 관련 액션 추가
- 게시글 작성/수정 폼에 드래그앤드롭 파일 업로드 UI
- 게시글 상세에 첨부파일 목록 표시
- tenant 디스크 설정 (공유 스토리지)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-02 00:53:25 +09:00
parent 7c7c04f8dc
commit 8948aa86d0
15 changed files with 2394 additions and 4 deletions

View File

@@ -174,4 +174,43 @@ public function canAccessMng(): bool
{
return $this->belongsToHQ() && $this->is_active;
}
/**
* 특정 역할 보유 여부 확인
*
* @param string|array $roles 역할명 또는 역할명 배열
*/
public function hasRole(string|array $roles): bool
{
// 슈퍼관리자는 모든 역할 보유
if ($this->is_super_admin) {
return true;
}
$roles = is_array($roles) ? $roles : [$roles];
// 현재 테넌트 기준 역할 확인
$currentTenant = $this->currentTenant();
if (! $currentTenant) {
return false;
}
$userRoles = $this->getRolesForTenant($currentTenant->id);
foreach ($roles as $roleName) {
if ($userRoles->contains('name', $roleName)) {
return true;
}
}
return false;
}
/**
* 관리자 역할 보유 여부 (admin 또는 super-admin)
*/
public function isAdmin(): bool
{
return $this->is_super_admin || $this->hasRole(['admin', 'super-admin']);
}
}