public function run() { DB::table('home_page_images')->delete(); $success = File::cleanDirectory($this->getImagesPath()); File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore')); HomePageImages::create(['image' => $this->copyImage(public_path() . '/backup_images/building/entrance.jpg')]); HomePageImages::create(['image' => $this->copyImage(public_path() . '/backup_images/building/hero.jpg')]); HomePageImages::create(['image' => $this->copyImage(public_path() . '/backup_images/building/lobby.jpg')]); }
public function deleteHomePageImage($id) { $homePageImage = HomePageImages::find($id); $path = HomePageImages::IMAGES_FOLDER . $homePageImage->image; $homePageImage->delete(); $this->deleteImageFromFileSystem($path); }