"There are no commands defined in the "icons" namespace." when called via Widget Class
I have created a custom widget to execute some commands like sitemap generation, build caches, nuke caches. However, I am getting a namespace error. I have tried referencing command class in
Artisan::call()
but it didn't help.
Here's my code
Solution:Jump to solution
there is a condition for these commands its only run on console:
if ($this->app->runningInConsole())
so you'll need to register the command manually
in app.php...12 Replies
This seems to be problem with icon commands (caching & clearing),
icons:cache
called within filament:optimize
& icons:clear
called within filament:optimize-clear
.Solution
there is a condition for these commands its only run on console:
if ($this->app->runningInConsole())
so you'll need to register the command manually
in app.php
hmmm... Why are they made to be run in console only?
dont know π just checked the code and saw that
Thank you. It worked
However, Another problem is running laravel offered
optimize
command.
Request takes very long time and when response is received, it breaks the page. Page is not interactble anymore. Trying to click buttons show error in console:
I have singled out the commands and it seems view:cache
& config:cache
are the one which cause the problem.
My guess is that trying to build the caches invalidates current page and hence causes problem.are you running these command from a the browser?
Yes. From a filament widget.
I guess that can make some errors, if you refresh the page it will work fine without errors right?
dont understand why you want the end user to run these commands kinda dangers, it should be run with the deployment
Yes, If page is refreshed, it works fine.
It's an admin panel where we know what we are doing it. It's just in case thing.
I've done that previously for nova and custom pages of a custom backend.
Sometimes we do change some cached stuff and we need to clear and rebuild cache at those times.
I understand the need to flush some cache, but cacheing the views, config, icons, kinda high level to be done, these will affect all active sessions
just my thoughts on the subject, I am sure you know what you're doing π
you can refresh the page after running the action.
Caching has destroyed me more than relationships... So I tend to clear all cache & rebuild all!
I've checked the exit code and it's 0. So it seems like my guess is correct, page needs to be refreshed after the action is done.
Redirect not working after caching π€£ . It just breaks everything after cache. No redirect, notifications, events work normally. Seems like I'll have to bother manually.