- Morph map에 Post, Department 모델 등록 (ClassMorphViolationException 해결) - 파일 저장 방식을 API 스타일로 변경 (document_id + document_type) - 파일 미리보기 라우트 및 메서드 추가 (previewFile) - 게시글 상세 페이지에서 이미지 첨부파일을 본문 상단에 풀 너비로 표시 - 비이미지 첨부파일은 하단에 다운로드 목록으로 분리 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Boards\Post;
|
|
use App\Models\Tenants\Department;
|
|
use App\Models\User;
|
|
use App\Services\SidebarMenuService;
|
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
|
use Illuminate\Support\Facades\View;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
// SidebarMenuService 싱글턴 등록
|
|
$this->app->singleton(SidebarMenuService::class);
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Morph Map: Polymorphic 관계 모델 등록
|
|
Relation::enforceMorphMap([
|
|
'user' => User::class,
|
|
'post' => Post::class,
|
|
'department' => Department::class,
|
|
]);
|
|
|
|
// 사이드바에 메뉴 데이터 전달
|
|
View::composer('partials.sidebar', function ($view) {
|
|
$menuService = app(SidebarMenuService::class);
|
|
$menusBySection = $menuService->getMenusBySection();
|
|
|
|
$view->with([
|
|
'mainMenus' => $menusBySection['main'],
|
|
'toolsMenus' => $menusBySection['tools'],
|
|
'labsMenus' => $menusBySection['labs'],
|
|
]);
|
|
});
|
|
}
|
|
}
|