Closed dmb-220 closed 3 months ago
http://new.test/kb/\prologue\getting-started get Not Found
The requested URL was not found on this server.
You should configure the custom theme in you AppServiceProvider (app/Providers/AppServiceProvider.php) not in your Panel ServiceProvider
use Guava\FilamentKnowledgeBase\Filament\Panels\KnowledgeBasePanel;
KnowledgeBasePanel::configureUsing(
fn(KnowledgeBasePanel $panel) => $panel
->viteTheme('resources/css/filament/admin/theme.css') // your filament vite theme path here
);
@dmb-220 I can almost bet that you are registering this in your boot()
method like every other Filament setup plugin.
The docs, unusual of most filament plugins, instructs that it should be registered in the register method
.
I have a good number of filament plugins in my app, and this is the first and only plugin that registerd in register
method of service provider. @cooljet84 any ideas why this design decision please?
@cooljet84 i've got the same problem. i've added the configureUsing() function to my AppServiceProvider.php
but i still get the error that i need to use custom theme.
KnowledgeBasePanel::configureUsing(function (KnowledgeBasePanel $panel) {
return
$panel
->brandName('Knowledge base')
->guestAccess(true)
->disableBackToDefaultPanelButton()
// ->syntaxHighlighting() // Needs nodeJs on server
->viteTheme('resources/css/filament/portal/theme.css')
->middleware([
'requestlog',
]);
}
i'm using the same custom viteTheme as in my Portal filament admin panel.
I've also run the npm run build
and double checked the manual as stated here: https://filamentphp.com/docs/3.x/panels/themes#creating-a-custom-theme
if i just hardcode $this->viteTheme('resources/css/filament/portal/theme.css');
at the KnowledgeBasePanel.php in ```php
function getTheme(): Theme
{
$this->viteTheme('resources/css/filament/portal/theme.css');
everything works...
Also when i set breakpoints with XDebug.
KnowledgeBasePanel::configureUsing(function (KnowledgeBasePanel $panel) {
$test = $panel ; // added breakpoint here....
the debugger does not execute the function in ::configureUsing... so it looks like it's not correctly registered... as ComponentManager::resolve() should resolve the plugin...???
@damms005 You saved my evening ;)
Can somebody help me?
I placed this code in AppServiceProvider.php
And I can open my Knowledge Base
But I have 404 error
@lukas-frey I think I need your help..
@OlyaK95 I don’t understand why your url get encoded with \ also visible in your address bar with: %5C
\ are for namespaces, not paths in url. Not sure it is related to that. Just wild guessing
@OlyaK95 I don’t understand why your url get encoded with \ also visible in your address bar with: %5C
\ are for namespaces, not paths in url. Not sure it is related to that. Just wild guessing
I tried manually change path to http://filament.test/kb\prologue\getting-started
and to http://filament.test/kb/prologue/getting-started
Nothing changes... 404
I tried also change my locale to en
but I have %5C too.
What does the CLI command php artisan route:list --name=knowledge-base
say for the kb urls?
What do the PHP artisan route:list say for the kb urls?
Routes about kb
GET|HEAD kb ............................................................................................................................................................................................................................. filament.knowledge-base.pages.dashboard › Filament\Pages › Dashboard
POST kb/logout .................................................................................................................................................................................................................... filament.knowledge-base.auth.logout › Filament\Http › LogoutController
GET|HEAD kb/{record?} ................................................................................................................................................................................ filament.knowledge-base.resources.documentations.view › Guava\FilamentKnowledgeBase › ViewDocumentation
and your config ?
and your config ?
default
<?php
// config for Guava/KnowledgeBasePanel
return [
"panel" => [
"id" => env("FILAMENT_KB_ID", "knowledge-base"),
"path" => env("FILAMENT_KB_PATH", "kb"),
],
"docs-path" => env("FILAMENT_KB_DOCS_PATH", "docs"),
"model" => \Guava\FilamentKnowledgeBase\Models\FlatfileDocumentation::class,
"cache" => [
"prefix" => env("FILAMENT_KB_CACHE_PREFIX", "filament_kb_"),
"ttl" => env("FILAMENT_KB_CACHE_TTL", "forever"),
],
];
you're caching infinite so try to clear cache php artisan cache:clear
and the docs folder in is your root project folder with
docs (folder) -> en (folder) -> proloque (folder) getting-started.md (file)
you're caching infinite so try to clear cache
php artisan cache:clear
and the docs folder in is your root project folder withdocs (folder) -> en (folder) -> proloque (folder) getting-started.md (file)
I did php artisan optimize:clear
I also tried delete Chrome cache
Then I deleted my docs/ru
directory and recreated it
Now I have error
And I assume you also registered the plugin in you PanelProvider of you filament panel? as otherwise it would not show up in routes list.
->plugins( [KnowledgeBasePlugin::make() ])
If this does not work i'm also out of options as here v1.9.0 it works, with same config (except for the "forever")
And I assume you also registered the plugin in you PanelProvider of you filament panel? as otherwise it would not show up in routes list.
->plugins( [KnowledgeBasePlugin::make() ]) If this does not work i'm also out of options as here v1.9.0 it works, with same config (except for the "forever")
Of course
i see that the FlatfileDocumentation class uses Sushi package which uses by default an sqlite db (which is just a binary file in the project) it tries to insert the data into this sqlite file but the syntax is incorrect. So you haven't edited the the vendor/guava/filament-knowledge-base/ files?
perhaps also remove calebporzio/sushi from vendor folder.
to be sure: remove this folder, and run composer install again. it will redownload the whole package. furthermore you are sure you don't use any special characters in the *.md files?
also make sure sushi works correctly and it meets your requirements: https://github.com/calebporzio/sushi
sqlite file should be in folder : storage/framework/cache/sushi-xxxxxx.sqlite
as written in de readme of sushi, if it cant create an sqlite file it will use in-memory. you'll then have to check whether there are any .env requirements needed for that or that it just works out of the box (the fallback with in-memory)
i see that the FlatfileDocumentation class uses Sushi package which uses by default an sqlite db (which is just a binary file in the project) it tries to insert the data into this sqlite file but the syntax is incorrect. So you haven't edited the the vendor/guava/filament-knowledge-base/ files?
perhaps also remove calebporzio/sushi from vendor folder.
to be sure: remove this folder, and run composer install again. it will redownload the whole package. furthermore you are sure you don't use any special characters in the *.md files?
No, I don't edit any files in this folder.
I did it, reinstall package
sqlite file should be in folder : storage/framework/cache/sushi-xxxxxx.sqlite
I have no file sqlite(
I think you have to debug further. as normally it should work. try dd() instead of the return statement of the FlatfileDocumentation.php Models file in the public function getRows() {
return collect(.....)->toArray();
change temporary to:
dd(collect(....)->toArray());
you should get something like this:
array:1 [▼ // vendor/guava/filament-knowledge-base/src/Models/FlatfileDocumentation.php:35
0 => array:9 [▼
"id" =>
Illuminate\Support
\
Stringable {#5526 ▶}
"slug" => "proloque/getting-started"
"path" => "/projectdir/docs/en/proloque/getting-started.md"
"content" => """
<h1 class="text-3xl mb-2 [&:first-child]:mt-0 mt-10 relative"><a id="introduction" href="#content-introduction" class="gu-kb-anchor md:absolute md:-left-8 m
▶
<p class="mb-4 [&:last-child]:mb-0 leading-relaxed">Lorem ipsum dolor ...</p>
"""
"title" => "Getting Started"
"group" => "Proloque"
"icon" => "heroicon-o-book-open"
"parent" => null
"order" => null
]
]
DON'T FORGET TO REVERT THE dd() ...!!!
@eelco2k I got this
I think i know the issue: it's in windows right? as the path is D:\
it uses all \ instead of /
those will not get replaced...
i think because \SplFileInfo $file works in windows differently...
some sort of
->replace('\\', '/')
has to be added
So not fully related to the package.... but GuavaCZ could do some find and replace...
for now i would suggest run the laravel project in laravel sail with WSL. you'll have linux containers for php etc. and you don't have the issue i bet
I think i know the issue: it's in windows right? as the path is D:\
it uses all \ instead of /
those will not get replaced...
i think because \SplFileInfo $file works in windows differently...
some sort of
->replace('\\', '/')
has to be added
You are right, it is Windows OS.
So not fully related to the package.... but GuavaCZ could do some find and replace...
for now i would suggest run the laravel project in laravel sail with WSL. you'll have linux containers for php etc. and you don't have the issue i bet
I am so grateful to you, thank you. I will wait GuavaCZ answer now.
Yeah, sorry, I will have to recheck all the classes and fix the path separators for all OSes. Thanks for the info.
@eelco2k Not sure if you fixed your issue, but as @damms005 suggested, the part where you configure your knowledge base panel (KnowledgeBasePanel::configureUsing(...)
) has to be done in the register
method, not in the boot
method.
This is because Filament registers all panels in the register
phase. If you run it during boot
, the panel will already be registered and all your customisations will not be applied by then yet.
@lukas-frey Yes fixed it 👍
What feature would you like to add?
The knowledge base panel needs to be registered with a custom vite theme. new install laraavel new versio 11.10 new filament 3.2.85 press documentation button get error
Notes
No response