fix(post): 게시글 첨부파일 조회 오류 수정
문제: - morphMany 사용 시 "No morph map defined" 에러 발생 - 시스템 게시판 파일 조회 시 tenant_id 불일치로 빈 배열 반환 해결: - AppServiceProvider: Post 모델을 enforceMorphMap에 등록 - Post::files(): morphMany → hasMany(document_type/document_id 기반)로 변경 - Post::files(): TenantScope 제외하여 시스템 게시판 파일 조회 가능 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Boards\Post;
|
||||
use App\Models\Commons\Menu;
|
||||
use App\Models\Members\User;
|
||||
use App\Models\Tenants\Tenant;
|
||||
@@ -33,9 +34,10 @@ public function register(): void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// Morph Map: mng/api 프로젝트 간 User 모델 경로 통일
|
||||
// Morph Map: 다형성 관계 모델 등록 (enforceMorphMap 사용 시 필수)
|
||||
Relation::enforceMorphMap([
|
||||
'user' => User::class,
|
||||
'post' => Post::class,
|
||||
]);
|
||||
|
||||
// DB::enableQueryLog();
|
||||
|
||||
Reference in New Issue
Block a user