From de9e9f88df6cca154a32cf079c5b653e5332fc34 Mon Sep 17 00:00:00 2001 From: bangnokia Date: Sun, 24 Mar 2024 05:07:15 +0700 Subject: [PATCH] wip --- app/Commands/CleanCommand.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Commands/CleanCommand.php b/app/Commands/CleanCommand.php index 03bb688..cef044a 100644 --- a/app/Commands/CleanCommand.php +++ b/app/Commands/CleanCommand.php @@ -16,10 +16,13 @@ public function handle(): int { $finder = new Finder(); - $finder->files()->in(getcwd() . '/public')->name('*.html'); + $finder->in(getcwd() . '/public')->ignoreVCS(true); - foreach ($finder as $file) { - unlink($file->getRealPath()); + foreach ($finder as $item) { + if ($item->isFile()) { + unlink($item->getRealPath()); + unset($item); + } } $this->info('Cleaned the public directory');