From 54a2d84a004b5a6439bace6660b4f1ff54c6a254 Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Sat, 25 Jul 2026 01:18:29 +0500 Subject: [PATCH] Add category path resolution in DocumentationVersionService - Fetch category path using `getPathFromRoot` for the default project language. - Pass resolved `categoryPath` to the view. --- .../Services/Admin/Project/DocumentationVersionService.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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, ]);