- AppServiceProvider에 Relation::enforceMorphMap 설정 추가 - tokenable_type을 'user' 별칭으로 통일 - mng에서 생성한 토큰을 api에서 사용 시 500 에러 해결 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
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: mng/api 프로젝트 간 User 모델 경로 통일
|
|
Relation::enforceMorphMap([
|
|
'user' => User::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'],
|
|
]);
|
|
});
|
|
}
|
|
}
|