input('sort_order', 'desc'); // 알림 type 식별자 → 다국어 라벨 맵을 컬렉션 단위로 한 번만 로드 (N+1 회피) $user = $request->user(); $typeLabelMap = app(NotificationDefinitionRepositoryInterface::class) ->getLabelMap($user?->locale); return [ 'data' => $this->mapWithRowNumber(function ($notification) use ($request, $typeLabelMap) { return (new UserNotificationResource($notification)) ->withTypeLabelMap($typeLabelMap) ->toArray($request); }, $sortOrder), 'pagination' => [ 'current_page' => $this->resource->currentPage(), 'last_page' => $this->resource->lastPage(), 'per_page' => $this->resource->perPage(), 'total' => $this->resource->total(), 'from' => $this->resource->firstItem(), 'to' => $this->resource->lastItem(), 'has_more_pages' => $this->resource->hasMorePages(), ], ]; } }