diff --git a/src/Models/FlatfileDocumentation.php b/src/Models/FlatfileDocumentation.php index 86b37de..69a52d4 100644 --- a/src/Models/FlatfileDocumentation.php +++ b/src/Models/FlatfileDocumentation.php @@ -29,6 +29,11 @@ public function getLocale(): string return App::getLocale(); } + public function getFallbackLocale(): string + { + return App::getFallbackLocale(); + } + public function getRows() { $path = base_path( @@ -37,6 +42,14 @@ public function getRows() ->append($this->getLocale()) ); + if (! File::exists($path)) { + $path = base_path( + str(config('filament-knowledge-base.docs-path')) + ->append('/') + ->append($this->getFallbackLocale()) + ); + } + return collect(File::allFiles($path)) ->map(function (\SplFileInfo $file) use ($path) { $data = KnowledgeBase::parseMarkdown($file->getRealPath());