diff --git a/app/application/app/Services/Admin/Project/DocumentationService.php b/app/application/app/Services/Admin/Project/DocumentationService.php index d8b7291..0f7cd1d 100644 --- a/app/application/app/Services/Admin/Project/DocumentationService.php +++ b/app/application/app/Services/Admin/Project/DocumentationService.php @@ -87,18 +87,21 @@ final class DocumentationService extends Service return $this->errFobidden(__('Access is denied')); } + $defaultLanguage = $project->languages->where('is_default', 1)->first(); $documentation = new Documentation(); + $categoryPath = null; if ($categoryId !== null) { $documentation->category_id = $categoryId; + $categoryPath = $this->documentationCategoryRepository->getPathFromRoot($categoryId, $defaultLanguage); } - $defaultLanguage = $project->languages->where('is_default', 1)->first(); return $this->result([ 'version' => $version, 'project' => $project, 'documentation' => $documentation, 'categories' => $this->documentationCategoryRepository->getForSelect($version, $defaultLanguage), 'serviceTranslationEnable' => config('translation_service.enable', false), + 'categoryPath' => $categoryPath, ]); } @@ -119,17 +122,20 @@ final class DocumentationService extends Service return $this->errFobidden(__('Access is denied')); } + $defaultLanguage = $project->languages->where('is_default', 1)->first(); $withCategories = []; + $categoryPath = null; if ($documentation->category_id) { $withCategories[] = $documentation->category_id; + $categoryPath = $this->documentationCategoryRepository->getPathFromRoot($documentation->category_id, $defaultLanguage); } - $defaultLanguage = $project->languages->where('is_default', 1)->first(); return $this->result([ 'version' => $version, 'project' => $project, 'documentation' => $documentation, 'categories' => $this->documentationCategoryRepository->getForSelect($version, $defaultLanguage, null, $withCategories), 'serviceTranslationEnable' => config('translation_service.enable', false), + 'categoryPath' => $categoryPath, ]); }