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
public function buildCaches() : int
{
$exitCode = Artisan::call('filament:optimize');
return $exitCode;
}
public function nukeCaches() : int
{
$exitCode = Artisan::call('filament:optimize-clear');
return $exitCode;
}