diff --git a/app/application/app/Services/Admin/Project/DocumentationVersionService.php b/app/application/app/Services/Admin/Project/DocumentationVersionService.php index b208461..7afb898 100644 --- a/app/application/app/Services/Admin/Project/DocumentationVersionService.php +++ b/app/application/app/Services/Admin/Project/DocumentationVersionService.php @@ -80,7 +80,10 @@ final class DocumentationVersionService extends Service return $this->errFobidden(__('Access is denied')); } + $defaultLanguage = $project->languages()->where('is_default', 1)->first(); + $category = null; + $categoryPath = null; if (!\is_null($categoryId)) { $category = $this->documentationCategoryRepository->getCategoryById($categoryId); if (\is_null($category) || $category->version_id !== $version->id) { @@ -89,9 +92,9 @@ final class DocumentationVersionService extends Service if ($user->cannot('view', $category)) { return $this->errFobidden(__('Access is denied')); } + $categoryPath = $this->documentationCategoryRepository->getPathFromRoot($category->id, $defaultLanguage); } - $defaultLanguage = $project->languages()->where('is_default', 1)->first(); $with = [ 'content' => function (HasOne $hasOne) use ($defaultLanguage) { /** @var ?ProjectLanguage $defaultLanguage */ @@ -120,6 +123,7 @@ final class DocumentationVersionService extends Service 'project' => $project, 'category' => $category, + 'categoryPath' => $categoryPath, 'categories' => $categories, 'documentations' => $documents, ]);