*/ protected array $publishedAssets = []; public function handle(Filesystem $filesystem): int { foreach (FilamentAsset::getAlpineComponents() as $asset) { if ($asset->isRemote()) { continue; } $this->copyAsset($asset->getPath(), $asset->getPublicPath()); } foreach (FilamentAsset::getFonts() as $asset) { $assetPublicPath = $asset->getPublicPath(); foreach ($filesystem->allFiles($asset->getPath()) as $file) { if ($file->getExtension() === 'js') { continue; } $this->copyAsset($file->getPathname(), $assetPublicPath . DIRECTORY_SEPARATOR . $file->getFilename()); } } foreach (FilamentAsset::getScripts() as $asset) { if ($asset->isRemote()) { continue; } $this->copyAsset($asset->getPath(), $asset->getPublicPath()); } foreach (FilamentAsset::getStyles() as $asset) { if ($asset->isRemote()) { continue; } $this->copyAsset($asset->getPath(), $asset->getPublicPath()); } foreach (FilamentAsset::getThemes() as $asset) { if ($asset->isRemote()) { continue; } $this->copyAsset($asset->getPath(), $asset->getPublicPath()); } $this->components->bulletList($this->publishedAssets); $this->components->info('Successfully published assets!'); return static::SUCCESS; } protected function copyAsset(string $from, string $to): void { $filesystem = app(Filesystem::class); [$from, $to] = str_replace('/', DIRECTORY_SEPARATOR, [$from, $to]); $filesystem->ensureDirectoryExists( (string) str($to) ->beforeLast(DIRECTORY_SEPARATOR), ); $filesystem->replace($to, $filesystem->get($from)); $this->publishedAssets[] = $to; } }