From c05294a44dfd6bcf29d7801d042e789c292c4d1f Mon Sep 17 00:00:00 2001 From: EnesSacid-Buker <73346401+EnesSacid-Buker@users.noreply.github.com> Date: Tue, 20 Dec 2022 16:00:49 +0300 Subject: [PATCH] Updates trait added Added: the ability to delete old files or folders from the previous version with a single function --- app/Traits/Updates.php | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 app/Traits/Updates.php diff --git a/app/Traits/Updates.php b/app/Traits/Updates.php new file mode 100644 index 000000000..2f9a285a7 --- /dev/null +++ b/app/Traits/Updates.php @@ -0,0 +1,46 @@ +getPathByAlias($alias); + + foreach ($files as $file) { + File::delete($path . '/' . $file); + } + } + + /** + * delete the folders. + */ + public function deleteFolders(array $folders, $alias = null): void + { + $path = $this->getPathByAlias($alias); + + foreach ($folders as $folder) { + File::deleteDirectory($path . '/' . $folder); + } + } +}