'Adventure Awaits', 'link' => 'https://jhigucms.com/adventure-awaits', 'ordering' => 1, 'caption' => 'Embark on an exciting journey with us. Discover new places and create lasting memories.', 'image' => '2.jpg' ], [ 'title' =>'Journey of Discovery', 'link' => 'https://jhigucms.com/adventure-awaits', 'ordering' => 2, 'caption' => 'Discover hidden gems and make every moment count on your travels.', 'image' => '1.jpg' ], ]; foreach ($banners as $banner) { $cmsbanner = Banner::create([ 'uuid' => Str::uuid(), 'title' => $banner['title'], 'link' => $banner['link'], 'ordering' => $banner['ordering'], 'caption' => $banner['caption'], ]); // Add image to the created banner $this->uploadImageForBanner($banner['image'], $cmsbanner); } } private function uploadImageForBanner(string $imageFileName, $cmsbanner) { $seederDirPath = 'banners/'; // Generate a unique filename for the new image $newFileName = Str::uuid() . '.jpg'; // Storage path for the new image $storagePath = '/banners/' . $newFileName; // Check if the image exists in the seeder_disk if (Storage::disk('seeder_disk')->exists($seederDirPath . $imageFileName)) { // Copy the image from seeder to public $fileContents = Storage::disk('seeder_disk')->get($seederDirPath . $imageFileName); Storage::disk('public_uploads')->put($storagePath, $fileContents); $cmsbanner->image = $newFileName; $cmsbanner->image_path = $storagePath; $cmsbanner->save(); } } }