'Dr. Biken Shrestha', 'group_id' => '1', 'designation' => '(NMC-6766)', 'detail' => 'Consultant Orthodontics and Dentofacial Orthopedics BDS, MDS, PhD', 'image' => 't1.jpg' ], [ 'name' => 'Dr. Sanjay Ranjit', 'group_id' => '1', 'designation' => '(NMC-13464)', 'detail' => 'Consultant Dentistry and Endodontics MDS, AIIMS New Delhi', 'image' => 't2.jpg' ], [ 'name' => 'Dr. Padma Malla', 'group_id' => '2', 'designation' => '(NMC-7163)', 'detail' => 'Senior Consultant Dermatologist and Venerologist, LASER /Aesthetic Specialist MBBS, MD', 'image' => 't3.jpg' ], [ 'name' => 'Dr. Deepak Gautam', 'group_id' => '3', 'designation' => '(NMC-8969)', 'detail' => 'Consultant Joint Replacement and Orthopedics MBBS, MS Ortho, AIIMS , New Delhi', 'image' => 't4.jpg' ] ]; foreach ($teamMembers as $teamMemberData) { $teamMember = TeamMember::create([ 'uuid' => Str::uuid(), 'name' => $teamMemberData['name'], 'group_id' => $teamMemberData['group_id'], 'designation' => $teamMemberData['designation'], 'detail' => $teamMemberData['detail'] ]); // Add image to the created banner $this->uploadImageForBanner($teamMemberData['image'], $teamMember); } } private function uploadImageForBanner(string $imageFileName, $cmsbanner) { $seederDirPath = 'teamMembers/'; // Generate a unique filename for the new image $newFileName = Str::uuid() . '.jpg'; // Storage path for the new image $storagePath = '/teamMembers/' . $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(); } } }